[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-961) jsessionid=xxx in url breaks RESTful parameter rewriting

Radu Aghinii (JIRA) jira-events at lists.jboss.org
Wed Feb 28 18:07:14 EST 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-961?page=comments#action_12354650 ] 
            
Radu Aghinii commented on JBSEAM-961:
-------------------------------------

In the 1.1.6 code, at least, this is caused by the fact that 

SeamRedirectFilter.getViewId(String url, String pathInfo, String servletPath, String contextPath)
doesn't properly recognize a url  that looks like this:

/index.seam;jsessionid=xxxxxxxxxxxxx

the rest of the redirect filter works as expected.   For my immediate needs i modified the function as  shown below, but haven't had a chance to apply the fix to the "pathInfo" branch of the conditional or to track down where this code went in 1.2.0  (it seems to have moved) or to put together a proper patch.

   protected static String getViewId(String url, String pathInfo, String servletPath, String contextPath)
   {
      if (pathInfo!=null)
      {
         //for /seam/* style servlet mappings
         return url.substring( contextPath.length() + servletPath.length(), getParamLoc(url) );
      }
      else if ( url.startsWith(contextPath) )
      {
         //for *.seam style servlet mappings
         
         String extension = servletPath.substring( servletPath.lastIndexOf('.') );         
         if ( url.endsWith(extension) || url.contains(extension + '?') )
         {
            String suffix = Pages.getSuffix();
            return url.substring( contextPath.length(), getParamLoc(url) - extension.length() ) + suffix;
         }
         else {
            // if a ;jsessionid=xxxxxxxxx is tacked on to the url before the 
            // parameters, then remove it when considering the base url. 
            int jsessionIndex = url.indexOf(";jsessionid=");
            int paramLoc = getParamLoc(url);
            if(jsessionIndex > 0 && jsessionIndex < paramLoc) {
               String baseurl = url.substring(0,jsessionIndex);
               if (baseurl.endsWith(extension)) { 
                    String suffix=Pages.getSuffix();
                    String viewId = baseurl.substring(contextPath.length(), baseurl.length() - extension.length()) + suffix;
                    return viewId;
               }
            }
            return null;
         }
      }
      else
      {
         return null;
      }
   }

> jsessionid=xxx  in url  breaks RESTful parameter rewriting
> ----------------------------------------------------------
>
>                 Key: JBSEAM-961
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-961
>             Project: JBoss Seam
>          Issue Type: Bug
>    Affects Versions: 1.1.6.GA, 1.2.0.GA
>         Environment: jboss 4.0.5.GA    sun  jvm 1.5.0_10  ,    JSF  Sun RI 1.3_03 , facelets 1.1.12
> Seam 1.1.6.GA, 1.2.0.GA
>            Reporter: Radu Aghinii
>
> I have a Seam application that uses page parameters defined in pages.xml  and uses "redirect after post " navigation.
> The expected behavior is that when  a redirect to a seam view happens the current values of the parameters referenced in pages.xml are attached to the URL.
> ( In the 1.1.6.GA documentation this is described in 5.1.1.1  of the documentation.
> The specific point :
> "Any navigation rule with a <redirect/> to the view id transparently includes the request parameter. The value of the parameter is determined by evaluating the value binding at the end of the invoke application phase." ) 
> This works fine in the normal case where cookies are used for Servlet session management, however, if cookies are disabled, the functionality breaks and  the parameters are not added.
> The behavior is the same using 1.2.0.GA jars.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list