jerssey anotation to filter request based on header value

61 views Asked by At

Is there any annotation available in jersey API to achieve request filtration based on header value? The same is achieved in spring like

@RequestMapping(value = "/test", method = RequestMethod.POST, headers = {"version=v1.1"})

1

There are 1 answers

0
braunpet On

There is no way to do this by using annotations. However, you can access the HttpServletRequest, for example

public Response foo( @Context HttpServletRequest request ) {
    if( request.getHeader( "version" ).equals( "v1.1" ) }
       // ...
    }
}