Map @CookieValue, @RequestHeader etc. to POJO in Spring Controller -
i have bunch of params in controller , want map of them separate pojo keep readability. there @cookievalue, @requestheader need evaluate , aim solution map them pojo. how?
i saw possible solution on blog doesn't work, variable stays null.
controller:
@requestmapping(path = mapping_language + "/category", produces = mediatype.text_html_value) @responsebody public string category(categoryviewresolvemodel model) { dosomething(); }
and pojo this:
public class categoryviewresolvemodel { private string pagelayoutcookievalue; public categoryviewresolvemodel() { } public categoryviewresolvemodel( @cookievalue(value = "some_cookie", required = false) string pagelayoutcookievalue) { this.pagelayoutcookievalue = pagelayoutcookievalue; } ... other requestparams, pathvariables etc. }
according documentation it's not possible @cookievalue
, , @requestheader
.
this annotation supported annotated handler methods in servlet , portlet environments.
Comments
Post a Comment