{"id":2030,"date":"2017-03-23T21:48:34","date_gmt":"2017-03-23T21:48:34","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2030"},"modified":"2017-04-28T18:50:01","modified_gmt":"2017-04-28T18:50:01","slug":"restful-services-in-java-simple-server-example","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2017\/03\/23\/restful-services-in-java-simple-server-example\/","title":{"rendered":"Restful services in Java &#8211; simple server example"},"content":{"rendered":"<p>There are probably a lot of ways to create web services programs\u00a0but the simplest way I could think of was to create a project using Eclipse and Jersey.<\/p>\n<p>It turns out that restful services are really easy to summarize but a bit more involved to describe in the way of a teaching tutorial.<\/p>\n<p>I have read up on the topic in the O&#8217;Reilly published book &#8220;RESTful Java with JAX-RS 2.0&#8221; by Bill Burke. \u00a0 \u00a0There is a lot of information starting with how to do this the hard way from scratch all the while moving on to how JAX-RS and markup can simplify the task.<\/p>\n<p>I will not summarize everything that is described in\u00a0the book but I will say that it if you want to get a working knowledge of restful services this is a pretty easy way to go about it. \u00a0The book is pretty focused on the server side itself. \u00a0The nice thing about creating a server like this is that it is easy enough to test using a simple web browser.<\/p>\n<p>I have gone a small bit further and my examples will include some client code that will actually use the services that I created. \u00a0This is was done both as a simple java client and also with a simple html client that also used a bit of java script.<\/p>\n<p>It was this last part that actually seemed the most interesting as you can then control the entire &#8220;application&#8221; from server to client. \u00a0The book uses xml examples but I did also get do some research on both java script, JSON and html\/css. \u00a0It is possible that these are also highlighted in the future but at the moment they are not of a great interest to me.<\/p>\n<p>&nbsp;<\/p>\n<h2>Restful Services Setup from Scratch<\/h2>\n<p>There are a number of things that need to be setup for creating a web service and there are a number of ways to get this properly setup. \u00a0The way I choose was to create a new &#8220;Dynamic web project&#8221; in eclipse.<\/p>\n<p>I created a new workspace to ensure that all setup needs to be done from scratch.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2032 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-1.png\" width=\"613\" height=\"766\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-1.png 613w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-1-240x300.png 240w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p>In this first dialogbox you can see that the &#8220;Target runtime&#8221; is an empty list. \u00a0This is because no web server has been defined.<\/p>\n<p>Simply click on new runtime to define one.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2033 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-2.png\" width=\"525\" height=\"563\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-2.png 525w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-2-280x300.png 280w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>Simply select which version of Tomcat is installed on your computer. The version that I had installed was 8.5.11.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2034 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-3.png\" width=\"525\" height=\"563\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-3.png 525w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-3-280x300.png 280w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>Basically select the install directory of Tomcat.<\/p>\n<p>Note: The structure of the Tomcat installation should be the same regardless of what the install directory is called. \u00a0However, when I was first trying to get the permissions for Tomcat setup I had problems using any path other than \/opt\/tomcat. \u00a0Once the permissions were corrected any path could be used.<\/p>\n<p>Once the Tomcat server is defined, it is just a matter clicking through the next three dialog boxes.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2035 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-4.png\" width=\"613\" height=\"766\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-4.png 613w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-4-240x300.png 240w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-5.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2036 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-5.png\" width=\"613\" height=\"766\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-5.png 613w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-5-240x300.png 240w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<div id=\"attachment_2037\" style=\"width: 623px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-6.png\"><img aria-describedby=\"caption-attachment-2037\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-2037 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-6.png\" width=\"613\" height=\"766\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-6.png 613w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-6-240x300.png 240w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><p id=\"caption-attachment-2037\" class=\"wp-caption-text\">We can set the context root of our URI to anything at here.This example it is FirstRestful.<\/p><\/div>\n<p>Once you press Finish the rest of the structure is created.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-7.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-2038 size-full aligncenter\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-7.png\" width=\"259\" height=\"272\" \/><\/a><\/p>\n<h2>Step 2 &#8211; adding Jersey<\/h2>\n<p>What is Jersey? \u00a0It is an implementation of JAX-WS (Java API for XML Web Services<span class=\"s1\">) for creating web services in XML format.\u00a0\u00a0<\/span>This makes it really easy for creating a small server. \u00a0All that needs to be done is to move\u00a0the <a href=\"https:\/\/jersey.java.net\/download.html\" target=\"_blank\">Jersey libraries<\/a>\u00a0into the correct spot under the WebContent folder. \u00a0Once this has been done then the basic framework is in place.<\/p>\n<p>There is both a version 1 and version 2 of Jersey available on this site, newer must be\u00a0better so of course I downloaded 2.25.1.<\/p>\n<blockquote><p><strong>jaxrs-ri-2.25.1.zip<\/strong><\/p><\/blockquote>\n<p>This zip file contained three directories full of jar files, add all of these to the project. Simply unpack the zip and put all of the jars\u00a0files into the root of the WebContent\/WEB-INF\/lib directory.<\/p>\n<p>Now that Jersey is added to the project all that is left is the source code.<\/p>\n<h2>Step 3 &#8211; adding the code<\/h2>\n<p>The last bit is to add the restful code to the project. \u00a0This first example actually does little more than display &#8220;Hello World&#8221;.<\/p>\n<p>Ok, ok, I did get a bit ahead of myself and you can also see that I have created sayHelloXml and sayHelloHtml as well. \u00a0These were actually only used from the browser, you can forget about them for right now.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.acmesoft;\r\n\r\nimport javax.ws.rs.GET;\r\nimport javax.ws.rs.Path;\r\nimport javax.ws.rs.Produces;\r\nimport javax.ws.rs.core.MediaType;\r\n\r\n@Path(&quot;\/Communicate&quot;)\r\npublic class HelloWorldEx {\r\n\r\n    @GET\r\n    @Path(&quot;\/hello&quot;)\r\n    @Produces(MediaType.TEXT_PLAIN)\r\n    public String sayHelloTxt() {\r\n    \treturn &quot;Hello World\\nHaving a great time!&quot;;\r\n    }\r\n\r\n    @GET\r\n    @Path(&quot;\/hello&quot;)\r\n    @Produces( {MediaType.APPLICATION_XML})\r\n    public String sayHelloXml() {\r\n      \treturn &quot;&lt;Magazine&gt;&quot; +\r\n\t\t&quot;&lt;Year&gt;2016&lt;\/Year&gt;&quot; +\r\n\t\t&quot;&lt;Month&gt;6&lt;\/Month&gt;&quot; +\r\n\t\t&quot;&lt;Title&gt;Economist&lt;\/Title&gt;&quot; +\r\n\t\t&quot;&lt;Price&gt;9.99&lt;\/Price&gt;&quot; +\r\n\t&quot;&lt;\/Magazine&gt;&quot;;\r\n    }\r\n\r\n    @GET\r\n    @Path(&quot;\/html&quot;)\r\n    @Produces(MediaType.TEXT_PLAIN)\r\n    public String sayHelloHtml() {\r\n    \treturn &quot;&lt;h1&gt;This is 'h1' heading&lt;\/h1&gt;&quot;;\r\n    }\r\n}\r\n<\/pre>\n<p>There is one other small file that needs to be setup, it is the web.xml file. This is the configuration file to setup the Jersey for this servlet.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;web-app xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xmlns=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee&quot; xsi:schemaLocation=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd&quot; id=&quot;WebApp_ID&quot; version=&quot;3.0&quot;&gt;\r\n   &lt;display-name&gt;User Management&lt;\/display-name&gt;\r\n   &lt;servlet&gt;\r\n      &lt;servlet-name&gt;Jersey RESTful Application&lt;\/servlet-name&gt;\r\n      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;\/servlet-class&gt;\r\n         &lt;init-param&gt;\r\n            &lt;param-name&gt;jersey.config.server.provider.packages&lt;\/param-name&gt;\r\n            &lt;param-value&gt;com.acmesoft&lt;\/param-value&gt;\r\n         &lt;\/init-param&gt;\r\n      &lt;\/servlet&gt;\r\n   &lt;servlet-mapping&gt;\r\n   &lt;servlet-name&gt;Jersey RESTful Application&lt;\/servlet-name&gt;\r\n      &lt;url-pattern&gt;\/*&lt;\/url-pattern&gt;\r\n   &lt;\/servlet-mapping&gt;  \r\n&lt;\/web-app&gt;\r\n<\/pre>\n<p>This example creates a small hello world application using restful web services. \u00a0You can see that the URI to get the hello world is \/Communicate\/hello, but this is only a part.<\/p>\n<p>Eclipse does a lot for you. \u00a0One of the things it does is to create the context root of the URI. We can set it to any value we wish in the last step while creating our dynamic web project.<\/p>\n<blockquote><p>http:\/\/192.168.178.70:8080\/<strong>FirstRestful<\/strong>\/Communicate\/hello<\/p><\/blockquote>\n<h2>Step 4\u00a0&#8211; creating war file<\/h2>\n<p>The process of creating a war file couldn&#8217;t actually be much easier. \u00a0Simply right click on the project and select export and select war file. \u00a0This will open up the following dialog.<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/02\/firstrestful-10.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2049 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/02\/firstrestful-10.png\" width=\"525\" height=\"453\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/02\/firstrestful-10.png 525w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/02\/firstrestful-10-300x259.png 300w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>The destination in this case is \/tmp. \u00a0The file is then copied to the \/opt\/tomcat\/webapps directory in a second step. I could have set the permissions on the webapps directory to allow my user to write to it directly, however, that is not very security minded. \u00a0This isn&#8217;t an issue on a development machine but perhaps it is a bad habit to get into in general, thus the manual extra copy step.<\/p>\n<p>The three checkboxes are reasonably clear to their purpose. \u00a0It is possible to optimize for a specific version of tomcat. \u00a0Export source files simply includes the source code in the war file. \u00a0This might be interesting for an internal application for your company\u00a0but probably a bad idea if you are selling your application.<\/p>\n<h2>Step 5\u00a0&#8211;\u00a0releasing application to tomcat<\/h2>\n<p>Releasing the application is as simple as copying the war file to the\/opt\/tomcat\/webapps.<\/p>\n<ol>\n<li>stop Tomcat<\/li>\n<li>copy application to webapps directory<\/li>\n<li>start Tomcat<\/li>\n<\/ol>\n<p>Tomcat will unpack the war file into the webapps directory.<\/p>\n<div id=\"code-link-2030\" class=\"sh-link code-link sh-hide\"><a href=\"#\" onclick=\"showhide_toggle('code', 2030, 'Show files ', 'Hide code'); return false;\" aria-expanded=\"false\"><span id=\"code-toggle-2030\">Show files <\/span><\/a><\/div><div id=\"code-content-2030\" class=\"sh-content code-content sh-hide\" style=\"display: none;\"><\/p>\n<p>tomcat-VirtualBox FirstRestful # find . -name &#8220;*&#8221;<br \/>\n.<br \/>\n.\/WEB-INF<br \/>\n.\/WEB-INF\/web.xml<br \/>\n.\/WEB-INF\/classes<br \/>\n.\/WEB-INF\/classes\/com<br \/>\n.\/WEB-INF\/classes\/com\/acmesoft<br \/>\n.\/WEB-INF\/classes\/com\/acmesoft\/HelloWorldEx.class<br \/>\n.\/WEB-INF\/classes\/com\/acmesoft\/HelloWorldEx.java<br \/>\n.\/WEB-INF\/lib<br \/>\n.\/WEB-INF\/lib\/aopalliance-repackaged-2.5.0-b32.jar<br \/>\n.\/WEB-INF\/lib\/jersey-client.jar<br \/>\n.\/WEB-INF\/lib\/jersey-guava-2.25.1.jar<br \/>\n.\/WEB-INF\/lib\/javax.inject-2.5.0-b32.jar<br \/>\n.\/WEB-INF\/lib\/hk2-locator-2.5.0-b32.jar<br \/>\n.\/WEB-INF\/lib\/javax.servlet-api-3.0.1.jar<br \/>\n.\/WEB-INF\/lib\/persistence-api-1.0.jar<br \/>\n.\/WEB-INF\/lib\/org.osgi.core-4.2.0.jar<br \/>\n.\/WEB-INF\/lib\/javax.annotation-api-1.2.jar<br \/>\n.\/WEB-INF\/lib\/hk2-utils-2.5.0-b32.jar<br \/>\n.\/WEB-INF\/lib\/hk2-api-2.5.0-b32.jar<br \/>\n.\/WEB-INF\/lib\/jersey-common.jar<br \/>\n.\/WEB-INF\/lib\/osgi-resource-locator-1.0.1.jar<br \/>\n.\/WEB-INF\/lib\/jersey-container-servlet.jar<br \/>\n.\/WEB-INF\/lib\/javassist-3.20.0-GA.jar<br \/>\n.\/WEB-INF\/lib\/Jersey-LICENSE.txt<br \/>\n.\/WEB-INF\/lib\/jersey-server.jar<br \/>\n.\/WEB-INF\/lib\/javax.ws.rs-api-2.0.1.jar<br \/>\n.\/WEB-INF\/lib\/jaxb-api-2.2.7.jar<br \/>\n.\/WEB-INF\/lib\/jersey-container-servlet-core.jar<br \/>\n.\/WEB-INF\/lib\/jersey-media-jaxb.jar<br \/>\n.\/WEB-INF\/lib\/third-party-license-readme.txt<br \/>\n.\/WEB-INF\/lib\/validation-api-1.1.0.Final.jar<br \/>\n.\/META-INF<br \/>\n.\/META-INF\/MANIFEST.MF<br \/>\n.\/META-INF\/war-tracker<br \/>\ntomcat-VirtualBox FirstRestful #<\/p>\n<p><\/div>\n<p>&nbsp;<\/p>\n<h2>Step 6\u00a0&#8211;\u00a0viewing the result<\/h2>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-2195\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9-1024x576.png\" alt=\"\" width=\"640\" height=\"360\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9-1024x576.png 1024w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9-300x169.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9-768x432.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/03\/firstrestful-9.png 1327w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h2>Other configuration<\/h2>\n<p>In my opinion, this is actually a pretty good URI and isn&#8217;t nested too deep. \u00a0However, it is possible to add another level to it. \u00a0This additional level is defined in the web.xml file.<\/p>\n<pre>   &lt;servlet-name&gt;Jersey RESTful Application&lt;\/servlet-name&gt;\r\n      &lt;url-pattern&gt;\/<span style=\"color: #ff0000;\">newlevel<\/span>\/*&lt;\/url-pattern&gt;\r\n   &lt;\/servlet-mapping&gt;<\/pre>\n<p>With this change, there would be another level added to my URI but that seemed to be excessive to me.<\/p>\n<p>What might really be a better choice might be to change the root context. \u00a0If you do change your mind you can easily change this to anther value.This is done by simply changing the Web Project settings. \u00a0This can be selected from the properties menu (right click on the project and select properties).<\/p>\n<p><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-8.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2040 size-full\" src=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-8.png\" width=\"613\" height=\"549\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-8.png 613w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/01\/firstrestful-8-300x269.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p>This is all the steps you would need to do in order to create a working server. \u00a0This can easily be tested out using your web browser, or you can use other tools. \u00a0I will discuss that in the next step when I create the <a href=\"http:\/\/blog.paranoidprofessor.com\/index.php\/2017\/03\/30\/restful-services-in-java-simple-client-example\/\" target=\"_blank\">first client<\/a>.<\/p>\n<div class=\"\"><a href=\"http:\/\/blog.paranoidprofessor.com\/wp-content\/downloads\/FirstRestful.tar.gz\" target=\"_self\" class=\"emd_dl_blue\">Download files<\/a><\/div>        <style type=\"text\/css\">\r\n    .emd_dl_blue {\r\n        -moz-box-shadow:inset 0px 1px 0px 0px #bbdaf7;\r\n        -webkit-box-shadow:inset 0px 1px 0px 0px #bbdaf7;\r\n        box-shadow:inset 0px 1px 0px 0px #bbdaf7;\r\n        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5) );\r\n        background:-moz-linear-gradient( center top, #79bbff 5%, #378de5 100% );\r\n        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#378de5');\r\n        background-color:#79bbff;\r\n        -webkit-border-top-left-radius:0px;\r\n        -moz-border-radius-topleft:0px;\r\n        border-top-left-radius:0px;\r\n        -webkit-border-top-right-radius:0px;\r\n        -moz-border-radius-topright:0px;\r\n        border-top-right-radius:0px;\r\n        -webkit-border-bottom-right-radius:0px;\r\n        -moz-border-radius-bottomright:0px;\r\n        border-bottom-right-radius:0px;\r\n        -webkit-border-bottom-left-radius:0px;\r\n        -moz-border-radius-bottomleft:0px;\r\n        border-bottom-left-radius:0px;\r\n        text-indent:0;\r\n        border:1px solid #84bbf3;\r\n        display:inline-block;\r\n        color:#ffffff !important;\r\n        font-family:Georgia;\r\n        font-size:15px;\r\n        font-weight:bold;\r\n        font-style:normal;\r\n        height:41px;\r\n        line-height:41px;\r\n        width:153px;\r\n        text-decoration:none;\r\n        text-align:center;\r\n        text-shadow:1px 1px 0px #528ecc;\r\n    }\r\n    .emd_dl_blue:hover {\r\n        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff) );\r\n        background:-moz-linear-gradient( center top, #378de5 5%, #79bbff 100% );\r\n        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff');\r\n        background-color:#378de5;\r\n    }.emd_dl_blue:active {\r\n        position:relative;\r\n        top:1px;\r\n    }\r\n    <\/style>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are probably a lot of ways to create web services programs\u00a0but the simplest way I could think of was to create a project using Eclipse and Jersey. It turns out that restful services are really easy to summarize but &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2017\/03\/23\/restful-services-in-java-simple-server-example\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,3],"tags":[12,36,88],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2030"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2030"}],"version-history":[{"count":27,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2030\/revisions"}],"predecessor-version":[{"id":3441,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2030\/revisions\/3441"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}