Tag Archives: jax-rs

JAX-RS : Get Cookie value using @CookieParam in Jersey

Server can store state information in cookies on the client, and the same can be retrieved that information when the client makes its next request. Many web applications use cookies to set up a session between the client and the server. They also use cookies to remember identity and user preferences between requests. These cookie values are transmitted back and forth between the client and server via cookie headers.

Although, I do not prefer to use cookie but still it’s handy to use in JAX-RS services. Whether you are prefering or not is not the important, if it required to to solve our contextual problem it should be used. The @CookieParam annotation allows you to inject cookies sent by a client request into your JAX-RS resource methods.
Continue reading JAX-RS : Get Cookie value using @CookieParam in Jersey

JAX-RS : Mapping of URL Using @Path Annotation in Jersey

In JAX-RS, mapping of URL or handler URL is very easy by using @Path annotation, and it can be used on either class level mapping or method level mapping or on both level mapping. If you map on both on class and method , class level value comes first and method level value comes later in the URL and combination of URL must be unique through out the application. If your mapping would not be unique it throws exception while start up of application.
Continue reading JAX-RS : Mapping of URL Using @Path Annotation in Jersey