Thierry, Actually, I think setRedirectRef() (which in HTTP is expressed as a "Location" response header) *is* appropriate when the Response Status is SUCCESS_CREATED (HTTP: "201 Created"). It is used to indicate to the client the URI of the newly created Resource.
That's the current state, and it makes sense, but I think it may be causing some confusion, because even though in HTTP both SUCCESS_CREATED and the REDIRECTION_* statuses make use of the "Location" header, it has different semantic meaning in the two different cases; in the case of SUCCESS_CREATED it indicates the Location (URI) of the newly created Resource, in the case of REDIRECTION_*, it indicates the new Location (URI) of the original resource. So, we may want to consider adding a new method for use in the SUCCESS_CREATED case: instead of setRedirectRef(), perhaps it could be something like setNewResourceRef() - and the two should probably be mutually exclusive somehow, or they would collide and/or overwrite each other. Avi -- Avi Flax Lead Technologist arc90 | http://arc90.com On 6/29/07, Thierry Boileau <[EMAIL PROTECTED]> wrote:
Hello Michael, after reading the spec, SUCCESS_CREATED shows that the operation succeeds and allows you also to provide a representation with some information about the new resource, including "a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate". I don't think it can be meant as a redirection. I think also that the redirecRef is only used when the status of the response is a redirection status (3xx). The main explanation for this design choice is that there are several redirection status, and no default one. best regards, Thierry Boileau On 6/28/07, Michael Vogel <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to using restlets and have been experimenting with simple test > pages to make sure i understand how to use it (and so that i can write > some examples to help my coworkers learn it). > > I wrote a simple form submission test that works, except that the > redirection after returning SUCCESS_CREATED doesn't happen. I am under > the impression that setting getResponse().setRedirectRef(<some URL>); > sets the location header and redirects the browser to whatever URL is > specified. > > If i send the state REDIRECTION_SEE_OTHER, it redirects correctly. > > From the HTTP spec, it appears that using REDIRECTION_SEE_OTHER to > redirect the client to a view of > the created item after a post is acceptable, so I'm going with that > for now, but I thought SUCCESS_CREATED was supposed to do that also. > > Am I incorrect in expecting it to redirect on SUCCESS_CREATED? > > thanks for your time, > > Michael >

