我正在将现有应用程序从 Tomcat 迁移到 GAE。在本地测试时,xhtml 页面作为静态页面加载。所有处理都被绕过,包括我的过滤器。但是,如果我引用一个不存在的页面,我的安全过滤器会将请求转发到 login.xhtml 并且 JSF/facelet 呈现正常。
知道为什么要处理 xhtml 页面吗?
其他集成:eclipse Helios、gae 1.6.5、maven (eclipse/m2)、moharra 2.0.9、richfaces 4.2.0、spring 3.1.1
网页.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<!-- https://community.jboss.org/wiki/HowToUseRichFaces40WithGoogleAppEngine -->
<context-param>
<param-name>com.sun.faces.enableThreading</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>com.xyz.web.filter.SecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
</web-app>
更新:如果我添加以下映射并引用扩展名为 .jsf 的页面,它会起作用。直接引用 .xhtml ,仍然会加载源代码。为 .xhtml 引用 .jsf 扩展名是典型配置吗?如果是这样,您如何配置应用程序以使通过 .xhtml 访问时源不可用?
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>