Consider the following method:
@POST @Path("/search") public SearchResponse doSearch(SearchRequest searchRequest);
I would like this method to know about the user who made the request. Therefore, I need access to the cookie associated with the SearchRequest object sent from the user.
In the SearchRequest class, I have only this implementation:
public class SearchRequest { private String ipAddress; private String message; ...
And here is the request:
{ "ipAddress":"0.0.0.0", "message":"foobarfoobar" }
Along with this request, the browser sends a cookie when a user logs in.
My question is: how do I access a cookie in the context of the doSearch method?
java rest service jax-rs
user3673948
source share