Category: Jersey

jersey tutorials

Creating Custom JAX-RS MessageBodyWriter

A JAX-RS MessageBodyWriter is responsible for converting Java types to a stream. In this example we are creating a JAX-RS MessageBodyWriter that produces text/html. This class may be annotated using the @Produces annotation to restrict...
jersey tutorials

JAX-RS @BeanParam Example

The @BeanParam annotation is added to the JAX-RS 2.0 specification. It allows you to inject a pojo whose property methods or fields are annotated with any of the injection parameters supported by JAX-RS. To name...
jersey tutorials

JAX-RS @CookieParam CRUD Example

Cookies are used to set up a session between the client and server or to remember the identity and user preferences between requests. These cookie values are transmitted to and from the client and server...
jersey tutorials

JAX-RS @FormParam Example

We can post an HTML form directly to our JAX-RS service, we can read the request bodies by mapping the fields using the @FormParam annotation. Lets show how this works by a simple example. We...
jersey tutorials

Get HTTP Header Parameter in JAX-RS

When you need to get HTTP Header parameters with JAX-RS, you have a couple of options. You can use the @HeaderParam annotation provided by JAX-RS, Inject the HttpHeaders directly or inject the HttpServletRequest. Let’s show...