Dharmil Thakkar
Dharmil Thakkar

Reputation: 51

How to get request header value from http request in spring mvc using custom annotaion?

How to get request header value from http request in spring mvc based on custom annotation condition on Field level Element type without using any handlerMapping object?

Upvotes: 0

Views: 1343

Answers (1)

codependent
codependent

Reputation: 24442

I don't really get what you're asking, Spring MVC already offers an annotation to map request headers, see the doc

@RequestMapping("/displayHeaderInfo.do")
public void displayHeaderInfo(@RequestHeader("Accept-Encoding") String encoding,
        @RequestHeader("Keep-Alive") long keepAlive) {
    //...
}

Upvotes: 1

Related Questions