Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用过滤器进行身份验证我不想在开发阶段每次都登录,也不想在开发过程中评价过滤器我曾考虑使用项目阶段仅在生产模式下进行身份验证。
FacesContext由于不可用,如何在过滤器中检索项目阶段?
FacesContext
如果它<context-param>以web.xml通常的方式定义,那么您可以在过滤器中获取它,init()如下所示:
<context-param>
web.xml
init()
private boolean development; @Override public void init(FilterConfig config) { development = "Development".equals(config.getServletContext().getInitParameter("javax.faces.PROJECT_STAGE")); } // ...