----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi Jon,

... I took a look at the JSERV source and I found the following. In our case
the problem is related to the fact that we use a *relative path* to call the
servlet that does the actual redirect.

--- our code--
res.sendRedirect(res.encodeRedirectUrl(req.getRequestURI()+parameters))
---
where the result of the req.getRequestURI() is something like
"/servlet/servletname"

Now, a redirect (as specified by the HTTP1.1. rfc) is required to be based on
an absolute path...but read this :

--- SNIPPET from Servlet 2.2 API specs
It is legal to call this method with a relative URL path, however the
underlying container must translate the relative path to a fully qualified URL
for transmission back to the client.
--------

I don't have the 2.0 specs anymore to see what they say about this, to see how
this relates to JSERV... could you look this up ? But assuming the spec is
identical on that part, take a look at the JSERV source : it just tries to
detect an absolute path (based on the hostname), without restoring the absolute
path in case of a relative path... in our case that results in no modification
whatsoever... and a mystery solved... now wait and see what the servlet API 2.0
specs say...

--- actual JSERV code ---

public String encodeRedirectUrl(String url) {
        // Encode only if there is a session associated to the request
        // And if the redirection will come back here
        if (isRequestedSessionIdFromCookie()) {
            return url;
        } else if (session == null) {
            return url;
        } else if (url.indexOf(hostname) == -1) {
            return url;
        } else {
            return mgr.encodeUrl(url, session.id);
        }
    }
----------------

e-gret,
 Danny




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to