users@jersey.java.net

trivial question about HTTP Codes

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Sat, 26 Sep 2009 11:06:04 +0200

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