spring RequestHeader annotation on model object?
Can I put @RequestHeader on a model object property? I.e.
class MyModel {
String ua;
public void setUa(@RequestHeader开发者_运维百科("User-Agent") String ua) {
this.ua = ua;
}
}
This works with @RequestParam, but seems to have no effect when I use @RequestHeader. Am I missing something? And, if this isn't supported, is there some reason why?
You can do this only in controller methods. Not model objects. Check the documentation
精彩评论