You can access the HttpSession by injecting the HttpServletRequest using the @Context annotation and then getting the session from the request like so:
@Context
private HttpServletRequest servletRequest;
@Override
public ServerResponse preProcess(HttpRequest request, ResourceMethod method)
throws Failure, WebApplicationException
{
HttpSession session = servletRequest.getSession();
//Do something with the session here...
}
You can access the
HttpSession
by injecting theHttpServletRequest
using the@Context
annotation and then getting the session from the request like so: