Nov 8, 2018

Restful Web Services Patterns

Simple Root Resource
Create a RESTful root resource class with GET and PUT methods using Java API for RESTful Web Service (JSR-311). This pattern is useful for creating a simple HelloWorld service and wrapper services for invoking WSDL-based web services.

Container-Item
Create a pair of RESTful resource classes consisting of an item resource class and its container resource class using Java API for RESTful Web Service (JSR-311). Item resources can be created and added to the container resource using the POST method on the container resource class. Note that the URI for the newly created item resource is determined by the container resource.

Client-Controlled Container-Item
Create a pair of RESTful resource classes consisting of an item resource class and its container resource class using Java API for RESTful Web Service (JSR-311). This pattern is a slight variation of the Container-Item pattern. The difference is that there is no POST method on the container resource class for creating item resources. Instead, item resources are created using the PUT method on the item resource class. The reason this is called Client-Controlled Container-Item pattern is because the URI for the item resource is determined by the client and not the container resource.