Thanks Paul...
>A void results in a 204 response, assuming that no exception is thrown.
I didn't know that so I wanted to explicitly control the response code
and add the entries in the extended wadl documentation to include in the
resourcedoc.xml input to the wadl.
_______________________________________________
Mark A. Rabick - Software Engineer
Em: mark.rabick_at_ngc.com
> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Thursday, April 30, 2009 10:39 AM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] DELETE Response status code...
>
> Hi Mark,
>
> On Apr 30, 2009, at 5:33 PM, Rabick, Mark A (IS) wrote:
>
> > What is the best choice for an HTTP response status code for the
> > successful deletion of a 'resource'? I have a DELETE method:
> >
> > @DELETE @Path("{sk: [a-zA-Z0-9 ]{1,32}}")
> > public synchronized Response
> > deleteNodeBySk(@PathParam("nodesk") String nodeSk) {
> >
> > Response resp = null;
> >
> > Node nodeToDelete = new Node(nodeSk);
> > nodeRemote.delete(nodeToDelete);
> > /*
> > * Response Status code is 204 (No Content)
> > */
> > resp = Response.noContent().entity(null).build();
> > System.out.println("Deleted sk: " + nodeSk);
> >
> > return resp;
> > }
> >
> > I've looked at the examples and mostly see delete methods returning
> > 'void'. The method is synchronous above so the delete should be
> > complete before the method returns. Is the 204 (No Content)
> > appropriate or would a 205 (reset content) or 200 (ok)?
> >
>
> A 204, if you are not sending a response entity:
>
> @DELETE @Path("{sk: [a-zA-Z0-9 ]{1,32}}")
> public synchronized void deleteNodeBySk(@PathParam("nodesk")
> String nodeSk) {
>
> Response resp = null;
>
> Node nodeToDelete = new Node(nodeSk);
> nodeRemote.delete(nodeToDelete);
> }
>
>
> A void results in a 204 response, assuming that no exception
> is thrown.
>
>
> > I've seen a couple of different examples for each on 'the net'.
> >
> > The other question I have is on a 'create' method (@POST).
> I want to
> > return both the URI for the newly created entity as well as
> return the
> > created entity itself in the message body. Would the URL go in the
> > Location header? If so, how is that accomplished?
> >
>
> URI u = ...
>
> Response.created(u)...
>
> https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/
> Response.html#created(java.net.URI)
>
> Paul.
> > --mark
> >
> > _______________________________________________
> > Mark A. Rabick
> > Software Engineer
> > Northrop Grumman - Integrated Mission Systems (IS/DSD/IMS)
> 3200 Samson
> > Way Bellevue, NE 68123
> > Ph: (402) 293-7091
> > Em: mark.rabick_at_ngc.com
> > Remember PFC Ross A. McGinnis...
> > http://www.army.mil/medalofhonor/McGinnis/index.html
> > ... MA2 Michael A. Monsoor, Lt. Michael P. Murphy, Cpl.
> Jason Dunham,
> > SFC Paul Ray Smith and the rest...
> > http://www.cmohs.org/recipients/most_recent.htm
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>