You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Michael Homeijer <M....@devote.nl> on 2003/01/21 16:13:39 UTC

Translate relative redirects in absolute redirects

Hi,

In org.apache.cocoon.environment.http.HttpEnvironment.redirect() I found the
following code:

-----------------------------------------------------
        // 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);
        }
----------------------------------------------------------

Is this related to translating relative url's into absolute url's and
would this be the place to implement translating relative redirect url's in
absolute url's as mentioned in the following thread:

http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=103926206004897&w=2

TIA,
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Translate relative redirects in absolute redirects

Posted by Vadim Gritsenko <va...@verizon.net>.
Michael Homeijer wrote:

>Hi,
>
>In org.apache.cocoon.environment.http.HttpEnvironment.redirect() I found the
>following code:
>
>-----------------------------------------------------
>        // 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);
>        }
>----------------------------------------------------------
>
>Is this related to translating relative url's into absolute url's
>

AFAIR, this relates to error in websphere's relative-to-absolute 
translation.


> and
>would this be the place to implement translating relative redirect url's in
>absolute url's as mentioned in the following thread:
>
>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=103926206004897&w=2
>  
>

Yes, this could be the place. Right before first encodeRedirectURL call, 
so container gets only absolute URLs to encode.

Vadim



>TIA,
>Michael
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org