Previously we have learnt how to use @Produces annotation, Consuming JSON or Consuming XML separately. We have consumed either xml or json request but not both xml and json in a single method. In this example we will learn how to consume multiple media type which the client is giving as input, lets see how we can achieve it. … [Read more...]
JAX-RS REST @Produces both XML and JSON Example
In my previous article we have learnt how to use @Produces annotation. We have produced either xml or json response but not able to produce both xml and json in a single method. In this example we will learn how to produce multiple media type response depending upon the clients request we will produce response, lets see how we can achieve it. … [Read more...]
JAX-RS REST @Consumes Example
Previously we have learnt about how to produce different types of responses using @Produces annotation, In this article we will learn how to consume different types of request from the user using @Consumes annotation. @Consumes annotation is used to specify the MIME media types that a resource can consume. @Consumes can be applied at both class level and method level, If … [Read more...]
JAX-RS REST @Produces Example
Previously we have learnt about how to get parameters using @PathParam, @QueryParam, @Context, @FormParam, @MatrixParam annotations, In this article we will learn how to send different types of response back to the user using @Produces annotation. @Produces annotation is used to specify the MIME media types that a resource can produce and send back to the client. … [Read more...]
JAX-RS REST @FormParam Example
Previously we have learnt about @PathParam, @QueryParam, @Context, @MatrixParam annotations, In this article we will learn how to get the values from the Form which is getting submitted using @FormParam annotation. … [Read more...]
JAX-RS REST @MatrixParam Example
We already know how to get the values using @QueryParam, @Context and get path parameter using @PathParam annotation, now lets learn how to get the value of a Matrix parameter passed using @MatrixParam Annotation. Matrix Parameter will be in the form of Key Value pairs separated by semicolon (;) … [Read more...]
JAX-RS @Context Example
In our previous example we have learnt how to get the values using @QueryParam Annotation, now we will learn the usage of @Context annotation in getting the Query Parameters. … [Read more...]
JAX-RS @DefaultValue Example
In our previous example we have learnt how to get the values using @QueryParam Annotation, now we will learn the usage of @DefaultValue annotation with @QueryParam. @DefaultValue is used to set a default value to the query param even when the parameters are not passed. … [Read more...]
JAX-RS @QueryParam Example
We know there are two ways to pass the parameter in a GET request of the REST Service. First way is using @PathParam and the Other way is using @QueryParam. We have already learnt how to use @PathParam annotation, Now lets look into @QueryParam in this tutorial. … [Read more...]
JAX-RS @PathParam Example
In this example, we will learn how to use the @PathParam annotation to get the Parameter passed in the URI in JAX-RS RESTful service.@PathParam parses the values of the parameter which is passed through @Path annotation. … [Read more...]
JAX-RS @Path URI Matching Example
In JAX-RS, you can use @Path annotation to bind URI pattern to a Java method. In this example, we will learn how to use the @Path in a JAX-RS RESTful service to direct the user to different methods based on the values passed in the URI. … [Read more...]
JAX-RS Jersey Hello World Example
In this tutorial, we will create a simple hello world web service with the JAX-RS reference implementation Jersey, which is the reference implementation of the JSR 311 specification.JAX-RS is part of the Java EE. … [Read more...]