{"id":75431,"date":"2018-04-11T19:00:01","date_gmt":"2018-04-11T16:00:01","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=75431"},"modified":"2018-04-11T11:11:32","modified_gmt":"2018-04-11T08:11:32","slug":"jax-rs-tutorial-with-jersey-for-restful-web-services","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html","title":{"rendered":"JAX-RS Tutorial with Jersey for RESTful Web Services"},"content":{"rendered":"<p>In today&#8217;s world data plays a very important role. With so many applications using various types of data for different operations, the most important aspect is communication between applications. Data sharing becomes easy between application when they can communicate.<\/p>\n<p>It&#8217;s like an application running in Asia is providing data to an application running in Europe or vice versa. How is it possible that Facebook servers hosted in the USA are able to provide Facebook services in Asia? How is it possible that validate using Google account option is available in so many websites hosted on different parts of the world?<\/p>\n<p>The answer to the above questions is Web services. There are two types of web services as mentioned below.<\/p>\n<ol>\n<li>REST web service<\/li>\n<li>SOAP web service<\/li>\n<\/ol>\n<p>Let us discuss in detail about REST web service.<\/p>\n<h2>1. Introduction<\/h2>\n<h3>1.1 REST<\/h3>\n<p>REST is an architecture principle for data transmission based on Web-standards and HTTP protocol. In REST, there are resources which are hosted using REST server. Every resource will have a unique Id known as URI and can be modified and accessed using REST client.<\/p>\n<p>REST allows representation of resources in different formats like XML, JSON, Text, etc.<\/p>\n<h3>1.2 HTTP Operations<\/h3>\n<p>As REST supports HTTP protocol it allows following operations on the resources.<\/p>\n<ul>\n<li>GET &#8211; GET request is used for accessing a resource and it provides a representation of the resource in the desired format.<\/li>\n<li>POST &#8211; POST request is used for updating of an existing resource. It is also used for the creation of the new resource. It supports resource representation in various formats.<\/li>\n<li>PUT &#8211; PUT request is used for updating a resource by completely replacing the existing one. As per the definition, PUT request is idempotent.<\/li>\n<li>DELETE &#8211; DELETE request is used for removing a resource.<\/li>\n<\/ul>\n<p>In REST web services also we have two different flavours of REST web services as mentioned below.<\/p>\n<ul>\n<li>RESTful web service<\/li>\n<li>RESTless web service<\/li>\n<\/ul>\n<p>We will discuss in detail about RESTful web services as part of the tutorial.<\/p>\n<h3>1.3 RESTful Web Services and JAX-RS<\/h3>\n<p>RESTful web services are the ones that follow REST based architecture and are majorly used for websites. It&#8217;s simple and fast as it is not bounded by strict restriction and consumes less bandwidth.<\/p>\n<p>Java came up with programming specification for the creation of web service in accordance with REST architecture. The name for this API specification is JAX-RS which stands for Java API for RESTful Web Services. JAX-RS was part of Java SE 5 and became a permanent member of the Java family from Java EE 6. The current version of JAX-RS is version 2.1 and it was released in September 2017.<\/p>\n<h2>2. Annotations<\/h2>\n<p>Let&#8217;s discuss the different annotations and specification which are supported by JAX-RS.<\/p>\n<ul>\n<li><code>@Path<\/code>:- It tells the relative path of the resource class or method.<\/li>\n<li><code>@GET<\/code>:- The HTTP Get request, which is used to fetch the resource.<\/li>\n<li><code>@PUT<\/code>:- The HTTP PUT request, which is used to create a resource.<\/li>\n<li><code>@POST<\/code>:- HTTP POST request, which is used to create or update a resource.<\/li>\n<li><code>@DELETE<\/code>:- HTTP DELETE request, which is used to delete a resource.<\/li>\n<li><code>@HEAD<\/code>:- It is HTTP HEAD request, which is used to get status of method availability.<\/li>\n<li><code>@Produces<\/code>:- This tells the type of HTTP Response that is generated from the web service. For example, APPLICATION\/XML, APPLICATION\/JSON etc.<\/li>\n<li><code>@Consumes<\/code>:- This tells the type of HTTP Request that the web service can process. For example, APPLICATION\/XML can be used to send the request in XML format.<\/li>\n<li><code>@PathParam<\/code>:- It binds the parameter passed to the method to a value in the path.<\/li>\n<li><code>@QueryParam<\/code>:- This binds the parameter passed to the method to a query parameter in the path.<\/li>\n<li><code>@HeaderParam<\/code>:- This binds the parameter passed to the method to an HTTP header.<\/li>\n<li><code>@DefaultValue<\/code>:- It will assign a default value to a parameter that is passed to the method.<\/li>\n<li><code>@Context<\/code>:- It is the context of the resource. For example, HTTPRequest as a context.<\/li>\n<\/ul>\n<h2>3. Jersey<\/h2>\n<h3>3.1 What is Jersey<\/h3>\n<p>Jersey is an open source framework which is used for building RESTful web services. It is more than just the implementation of JAX-RS. Jersey provides its own APIs also in order to make web service creation more simple and useful. It also provides a number of SPIs to extend the framework based on developer&#8217;s needs.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>3.2 Components of Jersey<\/h3>\n<p>Jersey is full of a lot of features and component. But, there are major four components of Jersey. They are as follows.<\/p>\n<ul>\n<li><strong>Core Server:-\u00a0<\/strong>It is used for building RESTful web services. The components consist of jersey-core, jersey-server and jsr311-api.<\/li>\n<li><strong>Core Client:-<\/strong>\u00a0\u00a0For interaction with web services we need a client to communicate between web services. The components consist\u00a0of jersey-client.<\/li>\n<li><strong>JAXB support:-\u00a0<\/strong>Jersey provides support for JAXB. It makes XML to object conversion easy. The component which performs this support is jersey-server.<\/li>\n<li><strong>JSON support:-\u00a0\u00a0<\/strong>Jersey provides support for JAXB. It makes JSON to object conversion easy. The component which performs this support is jersey-server.<\/li>\n<li>Easy integration with Spring and Guice framework.<\/li>\n<\/ul>\n<p>These are some of the major components and features of Jersey. Now let&#8217;s discuss how to install Jersey.<\/p>\n<h3>3.3 Jersey Installation<\/h3>\n<p>There are two ways of installing Jersey in your program. We can use Gradle or we can perform a direct installation from jersey website.<\/p>\n<p>Let&#8217;s look at both ways.<\/p>\n<h4>3.3.1 Gradle<\/h4>\n<p>In case we are using Gradle then we have to add the following lines in the project-dependencies section.<\/p>\n<p><code>compile 'org.glassfish.jersey.containers:jersey-container-servlet-core:2.26'<\/code><\/p>\n<p>Please note that the name of the project has changed starting from version 2.26. All the earlier versions had the name only<code>jersey-container-servlet<\/code>.<\/p>\n<h4>3.3.2 Installation from Jersey Website<\/h4>\n<p>For installation of Jersey from its website, we can download the package available at the website which contains all the dependencies excluding the third party dependencies.<\/p>\n<p>You can download the package from this <a href=\"https:\/\/jersey.github.io\/download.html\">link<\/a>.<\/p>\n<p>After downloading the package extract the zip file and paste all the jars in the <code>WEB-INF\/lib<\/code> of your program. That&#8217;s all you are ready to use jersey now.<\/p>\n<h2>4. Tools and Technologies<\/h2>\n<p>Let us look at the technologies and tool used for building the program.<\/p>\n<ul>\n<li>Eclipse\u00a0Oxygen.2 Release (4.7.2)<\/li>\n<li>Java \u2013 version 9.0.4<\/li>\n<li>Gradle \u2013 4.6<\/li>\n<li>JAX-RS 2.1<\/li>\n<li>Jersey-2.26<\/li>\n<li>Tomcat 9.0<\/li>\n<\/ul>\n<h2>5. Project Structure<\/h2>\n<p>Our project structure will look as shown in the below image.<\/p>\n<p><figure id=\"attachment_75572\" aria-describedby=\"caption-attachment-75572\" style=\"width: 376px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/ProjectStructure_JCG.jpg\"><img decoding=\"async\" class=\"size-full wp-image-75572\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/ProjectStructure_JCG.jpg\" alt=\"\" width=\"376\" height=\"260\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/ProjectStructure_JCG.jpg 376w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/ProjectStructure_JCG-300x207.jpg 300w\" sizes=\"(max-width: 376px) 100vw, 376px\" \/><\/a><figcaption id=\"caption-attachment-75572\" class=\"wp-caption-text\">Project Structure for JAX-RS project<\/figcaption><\/figure><\/p>\n<p>The project structure shown above is for plan implementation of JAX-RS where libraries will be downloaded from Jersey website. For projects with build.gradle and pom.xml the project structure will differ slightly.<\/p>\n<h2>6. An objective of the program<\/h2>\n<p>As part of the program, we will try to create a simple web service using Jersey. Also, we will try to understand the configuration and setup that needs to be done in order to create a web service.<\/p>\n<h3>6.1 Jars<\/h3>\n<p>Following is the list of Jars that will be part of folder<code>WEB-INF\/lib<\/code>.<\/p>\n<p><figure id=\"attachment_75573\" aria-describedby=\"caption-attachment-75573\" style=\"width: 363px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/JarsforJaxrs_JCG.jpg\"><img decoding=\"async\" class=\"size-full wp-image-75573\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/JarsforJaxrs_JCG.jpg\" alt=\"\" width=\"363\" height=\"874\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/JarsforJaxrs_JCG.jpg 363w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/JarsforJaxrs_JCG-125x300.jpg 125w\" sizes=\"(max-width: 363px) 100vw, 363px\" \/><\/a><figcaption id=\"caption-attachment-75573\" class=\"wp-caption-text\">Jars as part of the build for JAX-RS project<\/figcaption><\/figure><\/p>\n<p>There are two ways to add the jars as part of the project. Both the ways are mentioned below.<\/p>\n<ol>\n<li><strong>Addition of Jar using build files:<\/strong> Jars can be added to the project using build file like build.gradle or pom.xml by providing the jars along with version as the dependencies.<\/li>\n<li><strong>Download from Jersey website:<\/strong> All the jars mentioned above are available as part of the Jersey package which can be downloaded and copy pasted at WEB-INF\/lib. <a href=\"https:\/\/jersey.github.io\/download.html\">Link<\/a> for downloading the Jars.<\/li>\n<\/ol>\n<h3>5.2 Configuration for JAX-RS<\/h3>\n<p>In order to use JAX-RS, we have to register Jersey as the dispatcher servlet for REST requests. We have to modify to <code>web.xml<\/code> have the following lines.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Web.xml for Jersey as Dispatcher servlet<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;?xml version = \"1.0\" encoding = \"UTF-8\"?&gt; \r\n&lt;web-app xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\" xmlns:web=\"http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n\txsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n\tid=\"WebApp_ID\" version=\"2.5\"&gt;\r\n\t&lt;display-name&gt;JAX-RS Application Demo&lt;\/display-name&gt;\r\n\t&lt;servlet&gt;\r\n\t\t&lt;servlet-name&gt;jersey-servlet&lt;\/servlet-name&gt;\r\n\t\t&lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;\/servlet-class&gt;\r\n\t\t&lt;init-param&gt;\r\n\t\t\t&lt;param-name&gt;jersey.config.server.provider.packages&lt;\/param-name&gt;\r\n\t\t\t&lt;param-value&gt;com.tutorial&lt;\/param-value&gt;\r\n\t\t&lt;\/init-param&gt;\r\n\t&lt;\/servlet&gt; \r\n\t&lt;servlet-mapping&gt;\r\n\t\t&lt;servlet-name&gt;jersey-servlet&lt;\/servlet-name&gt;\r\n\t\t&lt;url-pattern&gt;\/rest\/*&lt;\/url-pattern&gt;\r\n\t&lt;\/servlet-mapping&gt; \r\n&lt;\/web-app&gt;<\/pre>\n<p>There are different tags as part of the <code>web.xml<\/code>\u00a0for a different purpose. <code>display-name<\/code> is used only for the display purpose. <code>init-param<\/code> tag is used for initialization. We have used a param <code>jersey.config.server.provider.packages<\/code> this parameter defines which package Jersey will look into for service classes. The package defined here should contain service classes. <code>url-patter<\/code> this tag is used to define the URL pattern. By default, the start of the URL is going to be with the project name followed by the url-pattern defined at this tag.<\/p>\n<h3>6.3 Service class<\/h3>\n<p>The service class is responsible for processing the request. Once the request is received by the dispatcher servlet ( which in our case is Jersey), the request is transferred to the service class based on the URL path. The service class name is <code>HelloWorld.java<\/code><\/p>\n<p><span style=\"text-decoration: underline;\"><em>Service class for the project<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.tutorial;\r\n\r\nimport javax.ws.rs.GET; \r\nimport javax.ws.rs.Path;\r\nimport javax.ws.rs.PathParam;\r\nimport javax.ws.rs.core.Response;\r\n\r\n@Path(\"\/hi\")\r\npublic class HelloWorld\r\n{\r\n  @GET\r\n  @Path(\"\/{name}\")\r\n  public Response getMessage(@PathParam(\"name\") String name)\r\n  {\r\n    String outMsg = \"Hello \" + name + \"!\";\r\n    return Response.status(200).entity(outMsg).build();\r\n  }\r\n    \r\n}<\/pre>\n<p>In the code above <code>@Path<\/code>\u00a0is defined for the URL path. So, the URL will contain the project name, the url-pattern defined as part of the web.xml and the attribute supported with the <code>@Path<\/code> annotation. The request will be diverted to this class by the dispatcher servlet. <code>@GET<\/code> defined the type of HTTP method. If it contains<code>@Path<\/code> parameters with these <code>{}<\/code> brackets then those parameters are known as <code>@PathParam<\/code>. In our case <code>name<\/code> is a path parameter. You can define path at service level as well as at the method level.<\/p>\n<h3>6.4 Run the Program<\/h3>\n<p>In order to run the program, a web server is needed to run the web-service. For our program, we have used Apache Tomcat.<\/p>\n<p>Let&#8217;s create a war file and deploy the war on the tomcat server. Also, we can integrate the tomcat server with Eclipse. Once the Tomcat server is integrated with Eclipse and the project war is deployed on the server, we will get the following screen.<\/p>\n<p><figure id=\"attachment_75577\" aria-describedby=\"caption-attachment-75577\" style=\"width: 572px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Tomcat_JCG.jpg\"><img decoding=\"async\" class=\"size-full wp-image-75577\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Tomcat_JCG.jpg\" alt=\"\" width=\"572\" height=\"86\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Tomcat_JCG.jpg 572w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Tomcat_JCG-300x45.jpg 300w\" sizes=\"(max-width: 572px) 100vw, 572px\" \/><\/a><figcaption id=\"caption-attachment-75577\" class=\"wp-caption-text\">Tomcat integrated with Eclipse along with JAX-RS project<\/figcaption><\/figure><\/p>\n<p>Now let&#8217;s start the tomcat server.<\/p>\n<p>Once the tomcat server is started we will type the following URL into the browser.<\/p>\n<p><strong>http:\/\/localhost:8080\/JaxRsTutorial\/rest\/hi\/Anand<\/strong><\/p>\n<p>Observe that the URL first contains the project name followed by the url-pattern mentioned as part of the web.xml, then the service path and at the end the path parameter which is the name.<\/p>\n<p>The following screen will appear in the browser.<\/p>\n<p><figure id=\"attachment_75706\" aria-describedby=\"caption-attachment-75706\" style=\"width: 546px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Webservice_Browser_JCG.jpg\"><img decoding=\"async\" class=\"size-full wp-image-75706\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Webservice_Browser_JCG.jpg\" alt=\"\" width=\"546\" height=\"182\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Webservice_Browser_JCG.jpg 546w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/Webservice_Browser_JCG-300x100.jpg 300w\" sizes=\"(max-width: 546px) 100vw, 546px\" \/><\/a><figcaption id=\"caption-attachment-75706\" class=\"wp-caption-text\">Web service result on the browser<\/figcaption><\/figure><\/p>\n<h2>7. Download the Eclipse Project<\/h2>\n<p>This was a tutorial for JAX-RS using Jersey.<\/p>\n<div class=\"download\">You can download the full source code of this example here:\u00a0<strong><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/04\/JaxRsTutorial.zip\">JaxRsTutorial.zip<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s world data plays a very important role. With so many applications using various types of data for different operations, the most important aspect is communication between applications. Data sharing becomes easy between application when they can communicate. It&#8217;s like an application running in Asia is providing data to an application running in Europe &hellip;<\/p>\n","protected":false},"author":22230,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[439],"class_list":["post-75431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jax-rs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In today&#039;s world data plays a very important role. With so many applications using various types of data for different operations, the most important\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In today&#039;s world data plays a very important role. With so many applications using various types of data for different operations, the most important\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-11T16:00:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Anand Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anand Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\"},\"author\":{\"name\":\"Anand Kumar\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/69738684d820603e2d7199877fcab97e\"},\"headline\":\"JAX-RS Tutorial with Jersey for RESTful Web Services\",\"datePublished\":\"2018-04-11T16:00:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\"},\"wordCount\":1680,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"JAX-RS\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\",\"name\":\"JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2018-04-11T16:00:01+00:00\",\"description\":\"In today's world data plays a very important role. With so many applications using various types of data for different operations, the most important\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/04\\\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"JAX-RS Tutorial with Jersey for RESTful Web Services\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/69738684d820603e2d7199877fcab97e\",\"name\":\"Anand Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g\",\"caption\":\"Anand Kumar\"},\"description\":\"Anand has graduated from Kuvempu University, India in Electronics and Instrumentation department. He has over 8 years of IT experience and is mainly involved in design and programming for websites and server side logic using Java oriented technologies like spring-boot, spring-data, spring-security, Hibernate, etc. He has worked with start-up companies and small business setup to Large Multinational companies.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/anand-kumar-54b4a1b9\\\/ \"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/anand-kumar\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks","description":"In today's world data plays a very important role. With so many applications using various types of data for different operations, the most important","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html","og_locale":"en_US","og_type":"article","og_title":"JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks","og_description":"In today's world data plays a very important role. With so many applications using various types of data for different operations, the most important","og_url":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-04-11T16:00:01+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Anand Kumar","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Anand Kumar","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html"},"author":{"name":"Anand Kumar","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/69738684d820603e2d7199877fcab97e"},"headline":"JAX-RS Tutorial with Jersey for RESTful Web Services","datePublished":"2018-04-11T16:00:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html"},"wordCount":1680,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["JAX-RS"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html","url":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html","name":"JAX-RS Tutorial with Jersey for RESTful Web Services - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2018-04-11T16:00:01+00:00","description":"In today's world data plays a very important role. With so many applications using various types of data for different operations, the most important","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2018\/04\/jax-rs-tutorial-with-jersey-for-restful-web-services.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"JAX-RS Tutorial with Jersey for RESTful Web Services"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/69738684d820603e2d7199877fcab97e","name":"Anand Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f3c15ec93118950f8571d06f66acd10f962bf608f770ab21e4e81e5ba9c62241?s=96&d=mm&r=g","caption":"Anand Kumar"},"description":"Anand has graduated from Kuvempu University, India in Electronics and Instrumentation department. He has over 8 years of IT experience and is mainly involved in design and programming for websites and server side logic using Java oriented technologies like spring-boot, spring-data, spring-security, Hibernate, etc. He has worked with start-up companies and small business setup to Large Multinational companies.","sameAs":["https:\/\/www.linkedin.com\/in\/anand-kumar-54b4a1b9\/ "],"url":"https:\/\/www.javacodegeeks.com\/author\/anand-kumar"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/75431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/22230"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=75431"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/75431\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=75431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=75431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=75431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}