3 Replies Latest reply on Sep 17, 2007 11:18 AM by yuan guang

    How to hide ".seam" postfix in the URL? Thanks!

    yuan guang Newbie

      How to hide ".seam" postfix in the URL, or replace it with others, such as ".html" / ".xhtml" etc? Thanks very much!

        • 1. Re: How to hide
          Wolfgang Schwendt Newbie

          The idea is to change the mapping for the Seam servlet from extension based mapping to path based mapping. See Servlet specification or a book about Servlets.

          Or alternatively, when the use of extension based mapping should be continued, the URL pattern for the extension could be changed from <url-pattern>*.seam</url-pattern>
          to another extension.

          In both cases the <servlet-mapping> in the web.xml config file needs to be edited.

          But I cannot experiment with this now. Perhaps you or another user can and then describe here in this thread what changes you made in web.xml and whether this worked.

          • 2. Re: How to hide
            Jason Long Master

            I have been using .xhtml for a long time and it works perfectly.

            Here is a stripped down version of my web.xml that integrates Richfaces and Trinidad.

            <?xml version="1.0" ?>
            <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version="2.5">
            
             <!-- Ajax4jsf -->
             <context-param>
             <param-name>org.ajax4jsf.SKIN</param-name>
             <param-value>blueSky</param-value>
             </context-param>
            
             <!-- Seam -->
             <listener>
             <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
             </listener>
             <filter>
             <filter-name>Seam Filter</filter-name>
             <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
             </filter>
             <filter-mapping>
             <filter-name>Seam Filter</filter-name>
             <url-pattern>/*</url-pattern>
             </filter-mapping>
             <servlet>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
             </servlet>
             <servlet-mapping>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <url-pattern>/seam/resource/*</url-pattern>
             </servlet-mapping>
            
             <!-- Facelets -->
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>true</param-value>
             </context-param>
            
             <!-- JSF -->
             <context-param>
             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.xhtml</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>*.xhtml</url-pattern>
             </servlet-mapping>
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>server</param-value>
             </context-param>
            
             <!-- Trinidad - as suggested by a4j-trinidad example-->
             <context-param>
             <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
             <param-value>com.sun.facelets.FaceletViewHandler</param-value>
             </context-param>
             <filter>
             <filter-name>Trinidad</filter-name>
             <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
             </filter>
             <filter-mapping>
             <filter-name>Trinidad</filter-name>
             <url-pattern>*.xhtml</url-pattern>
             <dispatcher>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
             </filter-mapping>
             <context-param>
             <param-name>org.apache.myfaces.trinidad.CACHE_VIEW_ROOT</param-name>
             <param-value>false</param-value>
             </context-param>
             <servlet>
             <servlet-name>Trinidad Resources</servlet-name>
             <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
             </servlet>
             <servlet-mapping>
             <servlet-name>Trinidad Resources</servlet-name>
             <url-pattern>/adf/*</url-pattern>
             </servlet-mapping>
            
             <!-- Security -->
             <security-constraint>
             <web-resource-collection>
             <web-resource-name>Secure Content</web-resource-name>
             <url-pattern>*.xhtml</url-pattern>
             </web-resource-collection>
             <auth-constraint>
             <role-name>AuthorizedUser</role-name>
             </auth-constraint>
             <user-data-constraint>
             <transport-guarantee>NONE</transport-guarantee>
             </user-data-constraint>
             </security-constraint>
             <login-config>
             <auth-method>BASIC</auth-method>
             <realm-name>The Restricted Zone</realm-name>
             </login-config>
             <security-role>
             <description>The role required to access restricted content</description>
             <role-name>AuthorizedUser</role-name>
             </security-role>
            
             <!-- Welcome files -->
             <welcome-file-list>
             <welcome-file>index.xhtml</welcome-file>
             </welcome-file-list>
            
            </web-app>


            • 3. Re: How to hide
              yuan guang Newbie

              I simply modify <url-pattern>*.seam</url-pattern> to <url-pattern>*.html</url-pattern> in the web.xml config file, and it works perfectly, thanks :)