Hi Pavel,
I'd start with the resource reference exposed by Request, and use the
methods of the Reference object to do what you want, e.g.
response.redirectTemporary(
new Reference(
request.getResourceRef().getParentRef().getParentRef(),
"group/" + groupId
)
);
But Jerome and friends,
Now that I say it out loud, though, I can't think of a good reason why the
response.redirect* methods couldn't attempt this internally if they are
passed a relative URI string or reference, e.g. in o.r.d.Response:
public void setRedirectRef(Reference redirectRef){
if(redirectRef.isRelative()){ // relative redirects not legal in HTTP/1.1,
resolve
newRedirectRef = new Reference(
getRequest().getResourceRef(),
redirectRef.getFragment()
).getTargetRef();
// how come there isn't a Reference(Reference, Reference) constructor
anyway?
this.redirectRef = newRedirectRef;
} else {
this.redirectRef = redirectRef;
}
}
I would have to imagine this is *always* what the user would want when
passing a relative Reference or String into one of these redirects.
Thoughts, anybody?
- Rob
On 12/16/07, Pavel Kolesnikov <[EMAIL PROTECTED]> wrote:
>
> However, if I call
>
> response.redirectTemporary("group/" + groupId);
>
> it redirects to http://localhost:8080/group/groupId while I want it to
> redirect to http://localhost:8080/app/api/group/groupId (as I have
> written, http://localhost:8080/app/api is the root URL of my REST
> application).
>
>