1
votes

I'm migrating an existing app from Tomcat to GAE. When testing locally, the xhtml pages are loaded as static pages. All processing is bypassed including my filter. However, if I reference a page that doesn't exist, my security filter forwards the request to the login.xhtml and the JSF/facelet renders fine.

Any idea why the xhtml pages are getting processed?

Other integrations: eclipse Helios, gae 1.6.5, maven (eclipse/m2), moharra 2.0.9, richfaces 4.2.0, spring 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>

Update: It works if I add the following mapping and refer to the page with .jsf extension. Referring to the .xhtml directly, still loads the source. Is it typical configuration to refer to .jsf extension for a .xhtml? If so, how do you configure the app so the source isn't available when accessed via .xhtml?

 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.jsf</url-pattern>
 </servlet-mapping>
1
look for mkyoung fine tutorials.. might find something over there... google.com/…Daniel
Thanks again. One remaining question then is why the .xhtml url-pattern doesn't work on GAE as BalusC recommends in that thread. I'll revise the question once more and keep it open.s_t_e_v_e
GAE runs on Jetty server do some googling , might find some info, but do double check before... cause you might missed something...Daniel
Will do. You've already been my personal google assistant twice now. I'll take it from here. :)s_t_e_v_e

1 Answers

4
votes

If I correctly understand your needs, you should add

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

in appengine-web.xml

If you skip this, your web browser will get reply from "static file server", not from JSF.