Java Reference
In-Depth Information
Deleting a Resource
Problem
You want to provide a way for users to delete a resource in JAX-RS.
Solution
Use the @DELETE annotation on a resource method to indicate that it responds to HTTP
DELETE requests, and then remove the resource in the method body.
Discussion
This annotation works like some of the other HTTP annotations we've examined from JAX-
RS, with one primary difference: browsers only natively support GET and POST, not PUT
and DELETE. So if you want to permanently remove a resource, you can mark the method
with @DELETE and the runtime will invoke that method automatically. Then use whatever code
necessary to remove the resource from your persistent store.
Search WWH ::




Custom Search