Java jsf上的过滤器链&x2B;美丽的面孔+;春季安全

Java jsf上的过滤器链&x2B;美丽的面孔+;春季安全,java,spring,jsf,redirect,jsf-2,Java,Spring,Jsf,Redirect,Jsf 2,在jsf中,我通常可以在自动用于重定向的函数中返回字符串 例如: 爪哇: @ManagedBean @SessionScoped @Component public class TestController implements Serializable { public String testButton(){ return "index"; } } xHTML: <h:form> <p:commandButton v

在jsf中,我通常可以在自动用于重定向的函数中返回字符串

例如: 爪哇:

@ManagedBean
@SessionScoped
@Component
public class TestController implements Serializable {
    public String testButton(){  
        return "index";  
    }
}  
xHTML:

<h:form>  
    <p:commandButton value="return to index" actionListener="#{testController.testButton}" ajax="false" />  
</h:form>  
这让我想到,我的过滤链设置不正确

我的
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                             http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

    <!-- PrimeFaces -->
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <!-- "normal" Spring -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:spring/applicationContext.xml
            classpath:spring/security.xml
        </param-value>
    </context-param>

    <!-- Spring security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <context-param>
        <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
        <param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
    </context-param>

    <!-- filterchain -->
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Error Page 404 -->
    <error-page>
        <error-code>404</error-code>
        <location>/error.xhtml?errorID=404</location>
    </error-page>

</web-app>

facelets.DEVELOPMENT
真的
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.xhtml
org.springframework.web.context.ContextLoaderListener
上下文配置位置
类路径:spring/applicationContext.xml
类路径:spring/security.xml
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
javax.faces.FACELETS\u库
/WEB-INF/springsecurity.taglib.xml
springSecurityFilterChain
/*
404
/错误。xhtml?错误ID=404
那么现在我的具体问题是:

  • 警告是否来自错误的过滤器链配置
  • 如何正确配置过滤器链?在我看来,它必须是Spring security->PrettyFaces->“正常”JSF作为请求的管道。如果这个想法是正确的,我如何才能做到这一点
  • 为什么我只能将xhtml路径链接设置为错误404文档而不是PrettyFaces URL?这也是一个问题,因为一个坏的过滤链 非常感谢您的帮助:)
    您好,

    Christopher

    除此之外,托管bean上还有太多的注释。
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns="http://java.sun.com/xml/ns/javaee"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                                 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
    
        <!-- PrimeFaces -->
        <context-param>
            <param-name>facelets.DEVELOPMENT</param-name>
            <param-value>true</param-value>
        </context-param>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.xhtml</url-pattern>
        </servlet-mapping>
    
        <!-- "normal" Spring -->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                classpath:spring/applicationContext.xml
                classpath:spring/security.xml
            </param-value>
        </context-param>
    
        <!-- Spring security -->
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
        <context-param>
            <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
            <param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
        </context-param>
    
        <!-- filterchain -->
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <!-- Error Page 404 -->
        <error-page>
            <error-code>404</error-code>
            <location>/error.xhtml?errorID=404</location>
        </error-page>
    
    </web-app>