Question

I know that v3.0 has method getHeader() but what about 2.3? Maybe it possible to get from steam?

UPDATE:

Actually, I need the HTTP response header RESTful application. In some reason I have decided to do this in servlet filter... but without success... Solution @javax.ws.rs.core.Context HttpHeaders requestHeaders.

For example,

@javax.ws.rs.GET
public String invoceRestMethod(@Context HttpHeaders requestHeaders){
      MultivaluedMap<String, String> map = headers.getRequestHeaders();
      for (Map.Entry<String, List<String>> entry : map.entrySet()) {
      //  processing header.... 
      }     
}

Maybe in will help for someone. But any case, for Servlet issue still is opened

Was it helpful?

Solution

You cannot get the header from the stream*.

What you have to do is insert a proxy response object into the filter chain before your Servlet is called, and have that capture the header.


* Actually, you could potentially capture stuff from the stream using a proxy response and decode the headers. But if you are inserting a proxy response, it is simpler to capture the headers directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top