I've been trying out my web-app on different Servlet engines and have
found a discrepancy between the way response.sendRedirect() works on
Orion 0.9 beta versus JRun 3.0 beta. Orion behaved the way I expected,
but when I tried to find out from the Servlet 2.2 spec the way this
situation should be handled, I didn't find a clear answer.

Briefly, in my servlet, when I expected response.sendRedirect() to
interpret relative URLs as being relative to the servlet-context. This
is what Orion is doing, however JRun interprets them as relative to the
document root.

For instance, my web-app has a context path of "/cvg" and the servlet I
want to redirect to is mapped to "/dispatch". If I call
response.sendRedirect("/dispatch") on Orion, it translates the redirect
to "http://myhost/cvg/dispatch", however, on JRun, it translates it to
"http://myhost/dispatch". To get the result I want on JRun, I have to
make my call as response.sendredirect(request.getContextPath() +
"/dispatch").

The spec says about sendRedirect (Section 6.3) that, "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 haven't found
anywhere in the actual spec where it specifies exactly what "relative
path" would mean in this context, but relative to the contextPath is the
most reasonable interpretation as see it.

Can anyone shed light on this?

Yours, JonTom

    JT Kittredge
    ITA Software
    Cambridge, Massachusetts

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to