如何从泽西岛的 ContainerRequest 中提取请求属性?
HttpServletRequest
有一个方法。setAttribute(String, Object)
如何从 中提取此属性?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
}
}