The RESTful way, in my opinion, would be to respond with a status of 204
and no content, or a 200 with a representation of the current state of
the resource (i.e., your second option below) or a message describing
what you just did.

A redirect or a 200 with no entity both imply something that actually
hasn't happened.

....Michael

>-----Original Message-----
>From: Richard Bronkhorst [mailto:[EMAIL PROTECTED] 
>Sent: 18 September 2007 08:28
>To: [email protected]
>Subject: Re: PUT response
>
>hi justin
>
>Most of the time i send a redirect to the same url. This 
>causes the browser to do a GET on the same resource and fetch 
>the data. This has a downside that you get an extra request, 
>but the good thing is that you don't repost your data if you 
>press F5, since the GET request was the last one.
>
>this is the line of code i put at the end of my PUT function:
>this.getResponse().redirectSeeOther(url);
>
>If you don't want to use a redirect, you can also send a 
>representation back right away:
>this.getResponse().setEntity(this.getRepresentation(this.getPre
>ferredVariant()));
>
>Richard
>
>On 9/18/07, Justin Makeig <[EMAIL PROTECTED]> wrote:
>> Dumb question: what's the appropriate response to a PUT 
>request? When 
>> I implement Resource#put and nothing goes wrong I get a 200 status, 
>> but my Resource never visits its getRepresentation(Variant) 
>method to 
>> build a response payload. Is this the expected behavior or have I 
>> wired something incorrectly? I can't tell what's supposed to happen 
>> from the spec <http://www.w3.org/Protocols/rfc2616/rfc2616-
>> sec9.html#sec9.6>.
>> Any help would be much appreciated.
>>
>> Justin
>>
>
>
>--
>Richard Bronkhorst
>Software Developer
>
>Noterik BV
>P.O. Box 15189
>1001 MD Amsterdam
>The Netherlands
>
>T: +31 (0)20 5929 966
>F: +31 (0)20 5929 969
>
>www.noterik.com / www.noterik.nl / www.streamedit.com
>

Reply via email to