2 Replies Latest reply on Jan 12, 2009 4:06 PM by romain.dev.easycity.com

    Seam 2.1.1.CR1 : Different character encoding if string is url-rewrote (in pages.xml)

    romain.dev.easycity.com

      Hi guys,


      I'm using Seam 2.1.1.GA and JBoss 4.2.3.GA.


      I have a character encoding issue when I try to use the rewrite feature in pages.xml


      Here is the rule in pages.xml :


          <page view-id="/sitemap/city.xhtml">
               <action on-postback="false" execute="#{siteMapManager.initCategoryList}" />
          
               <rewrite pattern="/intl/{locale}/places/{country_code}:{country_name}/{city_name}" />
               <rewrite pattern="/places/{country_code}:{country_name}/{city_name}" />
                
               <param name="country_code" value="#{siteMapManager.iso3166}" />
               <param name="city_name" value="#{siteMapManager.cityName}" />
               <param name="locale" value="#{siteMapManager.localeToChange}" />
          </page>
      



      and the link in the .xhtml file :


      <h:outputLink value="/sitemap/city.seam?locale=#{locale}&amp;country_code=#{fn:toUpperCase(city.country.iso3166)}&amp;country_name=#{siteMapManager.countryDetails.nameClean}&amp;city_name=#{city.name}">#{city.name}</h:outputLink>
      





      • Turning url rewrite OFF, it is rendered like this :



      <a href="/sitemap/city.seam?locale=en&country_code=FR&country_name=france&city_name=BESAN%C3%87ON">BESAN&Ccedil;ON</a>
      



      When I click on it, it works fine, the string BESAN%C3%87ON becomes BESANÇON




      • Turning url rewrite ON, it is rendered like this :



      <a href="/intl/en/places/FR:france/BESAN%C7ON">BESAN&Ccedil;ON</a>
      



      When I click on it, it doesn't work, the string BESAN%C7ON remains BESAN%C7ON


      Thanks for your help.


      Best,


        • 1. Re: Seam 2.1.1.CR1 : Different character encoding if string is url-rewrote (in pages.xml)
          romain.dev.easycity.com

          NB :


          server.xml configuration :


              <Connector  port="8080"
                          address="${jboss.bind.address}"
                          maxThreads="250" 
                          maxHttpHeaderSize="8192"
                          emptySessionPath="true" 
                          protocol="HTTP/1.1"
                          enableLookups="false" 
                          redirectPort="8443" 
                          acceptCount="100"
                          connectionTimeout="20000" 
                          disableUploadTimeout="true"
                          useBodyEncodingForURI="true"
                          URIEncoding="UTF-8" />
          



          Components.xml :


             <web:character-encoding-filter      encoding="UTF-8" 
                                   override-client="true" 
                                      url-pattern="*.seam"/>



          Thank you for your help.


          It's one of the last issue to be able to migrate to Seam 2.1.1.GA.


          • 2. Re: Seam 2.1.1.CR1 : Different character encoding if string is url-rewrote (in pages.xml)
            romain.dev.easycity.com

            Here is my web.xml :



            <?xml version="1.0" ?>
            <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">
                 
               <!-- RichFaces -->
               
               <context-param>
                  <param-name>org.richfaces.SKIN</param-name>
                  <param-value>blueSky</param-value>
               </context-param>
               
               <!-- Suppress spurious stylesheets -->
            
               <context-param>
                  <param-name>org.richfaces.CONTROL_SKINNING</param-name>
                  <param-value>disable</param-value>
               </context-param>
            
               <context-param>
                  <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
                  <param-value>disable</param-value>
               </context-param>
            
               <!-- Change load strategy to DEFAULT to disable sending scripts/styles as packs -->
            
               <context-param>
                  <param-name>org.richfaces.LoadStyleStrategy</param-name>
                  <param-value>ALL</param-value>
               </context-param>
            
               <context-param>
                  <param-name>org.richfaces.LoadScriptStrategy</param-name>
                  <param-value>ALL</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 development mode (disable in production) -->
              
               <context-param>
                  <param-name>facelets.DEVELOPMENT</param-name>
                  <param-value>false</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>*.seam</url-pattern>
               </servlet-mapping>
                          
               <security-constraint> 
                  <display-name>Restrict raw XHTML Documents</display-name>
                  <web-resource-collection>
                     <web-resource-name>XHTML</web-resource-name>
                     <url-pattern>*.xhtml</url-pattern>
                  </web-resource-collection>
                  <auth-constraint/>
               </security-constraint>
               
               <!-- UrlRewriteFilter using tuckey library -->
               <filter>
                   <filter-name>UrlRewriteFilter</filter-name>
                   <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
               </filter>
               <filter-mapping>
                   <filter-name>UrlRewriteFilter</filter-name>
                   <url-pattern>/*</url-pattern>
                   <dispatcher>REQUEST</dispatcher>
                   <dispatcher>FORWARD</dispatcher>
               </filter-mapping>
            </web-app>