我尝试使用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()
我无法找到我在下一个请求中设置的标头。 有人可以让我知道添加请求标头的正确方法,标头的范围以及如何从请求中删除标头吗?