Bernhard Huber wrote:
hi,


Grab the latest Cocoon from CVS, and launch "build run".
Then point the browser to http://localhost:8888/

The redirect doesn't work it seems...

Then point to http://localhost:8888/samples/
It should redirect to http://localhost:8888/samples/welcome but instead it redirects to http://localhost:8888/welcome (one step back)

Then goto http://localhost:8888/samples/misc
It redirects to http://localhost:8888/samples/welcome

Now, if I put a / in front of the redirect url (should be relative to servlet context, no?) it seems to work.

There is something wrong with the redirection-resolving, but honestly I don't know if the problem is in Tomcat, that makes it all work, Cocoon or Jetty.

What is the correct behaviour?

As much as i remember relative redirects are not correct in a strict
sense, the servlet rfc spec say that redirects should be always absolute.
I have finally taken the time to hunt down the latast servlet 2.3 javadocs on redirects:
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String)

"
public void sendRedirect(java.lang.String location)
throws java.io.IOException

Sends a temporary redirect response to the client using the
secified redirect location URL. This method can accept
relative URLs; the servlet container must convert the
relative URL to an absolute URL before sending the response
to the client. If the location is relative without a
leading '/' the container interprets it as relative to
the current request URI. If the location is relative
with a leading '/' the container interprets it as
relative to the servlet container root.
"

-> the servlet container must convert the
relative URL to an absolute URL before sending the response
to the client.

Seems like it's a Jetty bug then, no?

Since we are using a system that has an environment abstraction, it probably would make sense if we did that relative->absolute resolving ourselves, no?

Weblogic and probably tomcat are relaxing this converting relative redirectURLs to absolute urls.

anyway a trace first jetty, next tomcat
jetty redirects for /samples/ to location /welcome

tomcat redirects for /cocoon2-local/samples/ to location /cocoon2-local/samples/welcome

I think the most correct way is to fix Cocoon sending only absolute redirect URLs
My opinion too, which is ok for me since it maintains maximum backard compatibility, and less problems in the future.


--
Nicola Ken Barozzi [EMAIL PROTECTED]
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to