users@jersey.java.net

Re: [Jersey] trivial question about HTTP Codes

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 28 Sep 2009 10:13:49 +0200

Hi,

I think a 400 or a 409 (Conflict) is more appropriate.

Paul.

On Sep 26, 2009, at 11:06 AM, Felipe Gaścho wrote:

> I created a registration URI, it works, but now I am thinking about
> the response codes ....
>
> URI:
>
> curl -i -d
> "name
> =YOUR_NAME&password=PLAIN_PASSWORD&login=YOUR_LOGIN&email=YOUR_EMAIL"
> http://fgaucho.dyndns.org:8080/arena-http/user
>
> You can try if you want.. it should send you an email to confirm your
> registration....
> * and don't worry, this is my own machine and all data are destroyed
> on every commit .. and I assure your data won't be used for anything
> else than my app tests...
>
> So, accessing the resource I got two distinct messages:
>
> ------------- 1st time access: a new user is created:
>
> HTTP/1.1 201 Created
> X-Powered-By: Servlet/2.5
> Server: Sun Java System Application Server 9.1_02
> Location: http://fgaucho.dyndns.org:8080/arena-http/user/fgaucho
> Content-Type: application/xml
> Content-Length: 0
> Date: Sat, 26 Sep 2009 08:39:53 GMT
>
> ------------- 2st time access: a new user is created:
>
> HTTP/1.1 304 Not Modified
> X-Powered-By: Servlet/2.5
> Server: Sun Java System Application Server 9.1_02
> Date: Sat, 26 Sep 2009 08:40:04 GMT
>
>
>
> So, when a resource already exist - and it cannot be overwritten (new
> user account for example), what is the most adequate HTTP response
> code ?
>
> I am using the Jersey code:
>
> return Response.notModified().build();
>
> is it enough or should I throw an error to make it more clear
> something went wrong in the server side?
>
> ????
>
>
> --
> Looking for a client application for this service:
> http://fgaucho.dyndns.org:8080/arena-http/wadl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>