Reputation: 11
Is it possible to put @CookieValue in a parameter object? I can't seem to get this to work whats is missing?
@RequestMapping(value = "/Users", method = RequestMethod.GET)
@ResponseBody
public Response getAllActiveUsers(CookieParameters parameterObject) {
return getUserImpl.getAllActiveUsers(parameterObject.userToken,
parameterObject.loggedInUserId);
}
Here is the parameter object class.
public class CookieParameters {
public String userToken;
public String loggedInUserId;
public CookieParameter(
@CookieValue(value = "Token", defaultValue = "") final String userToken,
@CookieValue(value = "LoggedInUserId", defaultValue = "") final String loggedInUserId) {
this.userToken = userToken;
this.loggedInUserId = loggedInUserId;
}
Upvotes: 1
Views: 794
Reputation: 8154
I do not think this is possible. From my understanding, the @CookieValue
can only be put on the parameters of a handler method. I think you would have to grab the @CookieValue
and put them in your parameter object manually.
Upvotes: 1