Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In a REST application, requests are stateless but sometimes applications use Cookies for various reasons (i.e. put login some stateless resource viewing information without embedding it into the URL such as the maximum number of items to retrieve). CookieParam is used to easily get the information.

Code Block
@Path("/")
public class RootResource {
    @GET
    public Response invokeWithParameters(@CookieParam("userIdmax") String userIdmaximumItems) {
        if(userId == null) {
            return Response.status(Status.BAD_REQUEST).build();
        }
        return Response.ok(/* some entity here */).build();
    }
}