title: Map @CookieValue, @RequestHeader etc. to POJO in Spring Controller
body: <p>I have a bunch of params in my controller and want to map all of them to a separate POJO to keep readability. There is also a @CookieValue, @RequestHeader I need to evaluate and aim for a solution to also map them to that POJO. But how?</p>
  
  <p>I saw a possible solution on a blog but it doesn't work, the variable stays null.</p>
  
  <p>Controller:</p>
  
  <pre><code>@RequestMapping(path = MAPPING_LANGUAGE + "/category", produces = MediaType.TEXT_HTML_VALUE)
  @ResponseBody
  public String category(CategoryViewResolveModel model) {
      doSomething();
  }
  </code></pre>
  
  <p>And my POJO is this:</p>
  
  <pre><code>public class CategoryViewResolveModel {
  
  private String pageLayoutCookieValue;
  
  public CategoryViewResolveModel() {
  }
  
  public CategoryViewResolveModel(
          @CookieValue(value = "SOME_COOKIE", required = false) String pageLayoutCookieValue) {
      this.pageLayoutCookieValue = pageLayoutCookieValue;
  }
  
  ... some other RequestParams, PathVariables etc.
  }
  </code></pre>