When you annotate a parameter with @RequestHeader
, the parameter retrieves the header information. So you can just do something like this:
@RequestHeader("Accept")
to get the Accept
header.
So from the documentation:
@RequestMapping("/displayHeaderInfo.do")
public void displayHeaderInfo(@RequestHeader("Accept-Encoding") String encoding,
@RequestHeader("Keep-Alive") long keepAlive) {
}
The Accept-Encoding
and Keep-Alive
header values are provided in the encoding
and keepAlive
parameters respectively.
And no worries. We are all noobs with something.