无法检索或删除手动设置的请求标头

时间:2012-01-06 06:30:22

标签: jsf servlets http-headers

我尝试使用HttpServletRequestWrapper类为HttpServletRequest添加标头。

MyServletRequestWrapper extends HttpServletRequestWrapper
MyServletRequestWrapper httpServletRequest= new MyServletRequestWrapper((HttpServletRequest) req);
/**A method which adds the the given header along with the existing headers to the req object**/

httpReq.addHeader("MY-HEADER-X1", "header 1");
HttpServletResponse httpServletResponse= (HttpServletResponse) response;
httpServletResponse.setHeader("My Header", "Value");

filterChain.doFilter(httpServletRequest, httpServletResponse);  

当我尝试通过

在请求中检索标头时,在JSF中
httpServletRequest.getHeader("") 

或通过

facesContext.getExternalContext().getRequestHeaderMap() 

我无法找到我在下一个请求中设置的标头。 有人可以让我知道添加请求标头的正确方法,标头的范围以及如何从请求中删除标头吗?

0 个答案:

没有答案