You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2002/03/22 03:01:31 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment/http HttpEnvironment.java

vgritsenko    02/03/21 18:01:31

  Modified:    src/java/org/apache/cocoon/environment/http
                        HttpEnvironment.java
  Log:
  Fix WebSphere encodeRedirectURL bug/feature.
  Works with and without PQ51545_eFix
  
  Revision  Changes    Path
  1.11      +12 -1     xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java
  
  Index: HttpEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HttpEnvironment.java	26 Feb 2002 12:41:39 -0000	1.10
  +++ HttpEnvironment.java	22 Mar 2002 02:01:31 -0000	1.11
  @@ -55,6 +55,7 @@
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Session;
  +import org.apache.cocoon.util.NetUtils;
   
   import javax.servlet.ServletContext;
   import javax.servlet.http.HttpServletRequest;
  @@ -67,7 +68,7 @@
   
   /**
    * @author ?
  - * @version CVS $Id: HttpEnvironment.java,v 1.10 2002/02/26 12:41:39 tcurdt Exp $
  + * @version CVS $Id: HttpEnvironment.java,v 1.11 2002/03/22 02:01:31 vgritsenko Exp $
    */
   public class HttpEnvironment extends AbstractEnvironment implements Redirector {
   
  @@ -176,6 +177,16 @@
           }
           // redirect
           String redirect = this.response.encodeRedirectURL(newURL);
  +
  +        // FIXME (VG): WebSphere 4.0/4.0.1 bug
  +        if (!newURL.startsWith("/") && newURL.indexOf(':') == -1 && redirect.indexOf(':') != -1) {
  +            getLogger().debug("Redirect: WebSpehere Bug Detected!");
  +            String base = NetUtils.getPath(request.getRequestURI());
  +            if (base.startsWith("/")) {
  +                base = base.substring(1);
  +            }
  +            redirect = response.encodeRedirectURL(base + '/' + newURL);
  +        }
   
           getLogger().debug("Sending redirect to '" + redirect + "'");
           this.response.sendRedirect (redirect);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org