0

I use PrettyFaces to URL-rewriting, I used Glassfish 4 as application server and I was managing well the urls with prettyfaces, but after migration of server to WildFly 8.0 I can not get the page using its id defined in pretty-config.xml (I can get the page only using the complet url ie domain:port/../page1.jsf)

here is web.xml:

<?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_3_0.xsd"
    version="3.0">

    <display-name>Cursus Management</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext-security.xml
            /WEB-INF/applicationContext.xml
        </param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>bootstrap</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>

    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <filter>
        <filter-name>Pretty Filter</filter-name>
        <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>Pretty Filter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <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>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

pretty-config.xml

<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3
http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">
<!-- Begin UrlMappings -->

<url-mapping id="test">
    <pattern value="/test" />
    <view-id value="/pages/test.jsf" />
</url-mapping>
<url-mapping id="home">
    <pattern value="/" />
    <view-id value="/pages/index.jsf" />
...
</pretty-config>

The dependency of prettyface defined in pom.xml:

<!-- PrettyFaces -->
    <dependency>
        <groupId>com.ocpsoft</groupId>
        <artifactId>prettyfaces-jsf2</artifactId>
        <version>3.3.3</version>
    </dependency>
Tiny
  • 27,221
  • 105
  • 339
  • 599
SSouhaieb
  • 248
  • 5
  • 16
  • 1
    WildFly 8.0 is old and has some awkward bugs as to HTTP session handling. Try the current 8.2 instead and report. – BalusC Jan 08 '15 at 09:34
  • 1
    And PrettyFaces 3.3.3 is also very old. You should consider to use Rewrite with the PrettyFaces module instead. See: http://ocpsoft.org/rewrite/ and the migration guide: http://ocpsoft.org/rewrite/docs/migration/prettyfaces3 – chkal Jan 08 '15 at 12:04
  • @BalusC thank you very much, you helped me to solve a lot of problems in these last days. chkal I did what you suggested and it works now. – SSouhaieb Jan 13 '15 at 08:44

1 Answers1

1

Have you tried a more recent version of Wildfly or PrettyFaces? Please see the updated installation instructions here: http://ocpsoft.org/prettyfaces/

(Note: PrettyFaces is now an extension of rewrite.)

Lincoln
  • 3,151
  • 17
  • 22