HttpServletRequest
的容器請求屬性有一個方法:提取請求從澤西島
setAttribute
我怎樣才能提取ContainterRequest
這個屬性?
我沒有找到:getAttribute
方法!
代碼
public class AuthenticationFilter implements Filter{
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpReq = (HttpServletRequest) servletRequest;
.... ....
httpReq.setAttribute("businessId", businessId);
}
}
在新澤西州過濾器:
private class Filter implements ResourceFilter, ContainerRequestFilter{
public ContainerRequest filter(ContainerRequest request) {
..extract the attribute from the httpReq
}
}
請問您可否包括一些代碼演示你想要做什麼? – 2013-06-04 06:31:46
我編輯了我的問題。謝謝! – Dejell