aspose file tools*
The moose likes Web Services and the fly likes (Restful web service) HTTP status code for EntityExistsException? duplicate data or key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "(Restful web service) HTTP status code for EntityExistsException? duplicate data or key" Watch "(Restful web service) HTTP status code for EntityExistsException? duplicate data or key" New topic
Author

(Restful web service) HTTP status code for EntityExistsException? duplicate data or key

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
404 for EntityNotFoundException (data or key not found)

??? for EntityExistsException (duplicate data or key during the Insert/creation)
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
1. From
http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/Response.Status.html
CONFLICT


2. From
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10

10.4.10 409 Conflict
The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough

information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.

Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type.

3. Question:

Can we apply it for POST?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (Restful web service) HTTP status code for EntityExistsException? duplicate data or key