2012-05-19 47 views
1

我正在將現有的應用程序從Tomcat遷移到GAE。在本地進行測試時,xhtml頁面將作爲靜態頁面加載。所有處理都被繞過,包括我的過濾器。但是,如果我引用一個不存在的頁面,我的安全篩選器會將該請求轉發到login.xhtml,並且JSF/facelet呈現正常。Google App Engine - JSF - Facelets - 爲什麼不將* .xhtml作爲url模式?

任何想法,爲什麼XHTML頁面越來越處理?

其他集成:日食太陽神,GAE 1.6.5,行家(蝕/平方米),moharra 2.0.9,4.2.0 RichFaces的,彈簧3.1.1

web.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> 
+0

找mkyoung精細教程..可能找到的東西在那裏... https://www.google.com/search?q=gae+mkyoung+jsf&ie=utf-8&oe=utf-8&aq=t&rls=org。 mozilla:en-US:official&client = firefox-a – Daniel

+0

感謝您的提示。 –

+0

不客氣。 – Daniel

回答

4

如果我正確理解你的需求,你應該添加

<static-files> 
    <exclude path="/**.xhtml" /> 
</static-files> 

中的AppEngine-web.xml中

如果您跳過此,Web瀏覽器將獲得由「靜態文件服務器的回覆「,而不是來自JSF。

相關問題