문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top