Can I check HTTP headers in a JAX-RS application using Interceptors?

Should it @Context HttpHeaderswork with Interceptor?

I created a class RestfulClassesthat extends javax.ws.rs.core.Applicationand annotates it @javax.ws.rs.ApplicationPath("/api")- everything is pretty standard.

I also have a class added to handle a specific path, which itself works just fine. The problem is that I would like to check the incoming HTTP headers, and using sniffers sounds perfect.

My interceptor class is declared @Context HttpHeaders httpHeaders, but inside the method @AroundInvokethis property is null.

Should I expect this to work or am I missing something? Is there another way?

+3
source share
1 answer

: , :

 @Context protected HttpHeaders headers;

@AroundInvoke, . , .

Artem , -. , - web.xml...

0

All Articles