I am working on a web application based on Java and JSF2.0 and I am using Google AppEngine to host it. I am using PrettyFaces for modifying the URLs. Since I started using PrettyFaces, if someone enters an invalid URL, redirect looping occurs like the following:
www.example.com
is the website so if you enter
www.example.com/invalidasdas
it keeps appending index.jsp to the end of the invalid URL such as :
www.example.com/invalidasdas/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp
I am not sure how I can fix this problem. Any suggestions to fix this would be nice. I can post my code if needed.
PrettyFaces Configuration:
<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
<url-mapping id="home">
<pattern value="/home/" />
<view-id value="/index.jsf" />
</url-mapping>
<url-mapping id="blog">
<pattern value="/blog/" />
<view-id value="/blog.jsf" />
</url-mapping>
<url-mapping id="stockpicks">
<pattern value="/stocks/" />
<view-id value="/stockpicks.jsf" />
</url-mapping>
<url-mapping id="login">
<pattern value="/login/" />
<view-id value="/adminlogin.jsf" />
</url-mapping>
<url-mapping id="dashboard">
<pattern value="/dashboard/" />
<view-id value="/dashboard.jsf" />
</url-mapping>
<url-mapping id="error">
<pattern value="/error/" />
<view-id value="/WEB-INF/error.jsf" />
</url-mapping>
<url-mapping id="search">
<pattern value="/search/#{searchBean.type}/#{searchBean.value}"></pattern>
<view-id value="/search.jsf"/>
</url-mapping>
</pretty-config>
And here's my web.xml file!
<?xml version="1.0" encoding="utf-8"?>
<web-app
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_2_5.xsd"
version="2.5">
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</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>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>otf</extension>
<mime-type>font/opentype</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<context-param>
<param-name>
javax.faces.WEBAPP_RESOURCES_DIRECTORY
</param-name>
<param-value>/WEB-INF/resources</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<error-page>
<error-code>404</error-code>
<location>/error/</location>
</error-page>
<session-config>
<session-timeout>10080</session-timeout>
<cookie-config>
<max-age>10080</max-age>
</cookie-config>
</session-config>
<filter>
<filter-name>PrettyFilter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrettyFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>filters.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/dashboard/*</url-pattern>
<url-pattern>/dashboard.jsf</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<security-constraint>
<display-name>Restrict direct access to XHTML files</display-name>
<web-resource-collection>
<web-resource-name>XHTML files</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
</web-app>
EDIT: It turns out that the issue is AppEngine and not PrettyFaces. Please stop editing posts without really looking into the problem. Someone removed the AppEngine tag and it is annoying!
I have the same issue that yours, but when I add "/WEB-INF" to view-id value it work ! ie:
it works, but I am not convinced by this solution, I am trying to investigate it