Closed chkal closed 9 years ago
Comment by Santiago Pericas-Geertsen:
Spec document updated.
Comment by Christian Kaltepoth:
Perhaps we should include some words about how absolute and relative paths are resolved here. I didn't check the current implementation in Ozark yet, but I would expect it like this. Say the application is deployed to the context path /myapp
and JAX-RS uses the application path /resources
:
||Controller result||Location Header in Response||
|redirect:resources/foobar
|/myapp/resources/foobar
|
|redirect:/resources/foobar
|/myapp/resources/foobar
|
|redirect:http://www.java.net/
|http://www.java.net/
|
The last example is something that Spring MVC supports. It is quite nice, but I'm not strong on this one. It would be OK to tell people to use a Response
in this case.
We could even automatically add the application path. In this case it would look like this:
||Controller result||Location Header in Response||
|redirect:foobar
|/myapp/resources/foobar
|
|redirect:/foobar
|/myapp/resources/foobar
|
Comment by Santiago Pericas-Geertsen:
Unless there's a good reason not to (which I can't think at the moment), our String-based support should be compatible with JAX-RS:
That's why I didn't get into too much detail about relative path resolution, although I don't see a problem expanding on this. Using a different algorithm for resolution could be very confusing when mixing styles.
Comment by Christian Kaltepoth:
This would mean that currently it would work like this:
||#||Controller result||Location Header in Response|| |A|redirect:foobar|/myapp/resources/foobar| |B|redirect:/foobar|/foobar| |C|redirect:http://www.java.net/|http://www.java.net/|
I'm fine with A & C. That is exactly like I would expect it. However, I'm not sure about B. That looks weird to me. Typically URLs (even if starting with a /
) are relative to the context path. Like in web.xml
for example. And with JSF you also return something like /foobar.xhtml?faces-redirect=true
.
Comment by Christian Kaltepoth:
Oh sorry, I just checked the Ozark code. Actually the leading slash is stripped from the path.
So it is currently implemented like this:
||#||Controller result||Location Header in Response|| |A|redirect:foobar|/myapp/resources/foobar| |B|redirect:/foobar|/myapp/resources/foobar| |C|redirect:http://www.java.net/|http://www.java.net/|
This is absolutely fine for me. Sorry for the confusion.
Original issue MVC_SPEC-45 created by Santiago Pericas-Geertsen:
Need to document forms of redirect.