There is Java library for RESTful Web Services, called JAX-RS.
JAX-RS RESTful principles are:
- assign everything an ID
- link things together
- use common set of methods
- allow multiple representations
- stateless communications
Classes and methods are annotated to generate REST service.
Here is an example:
@Path("/atm") public class AtmService { @GET @PATH("/balance") @Produces("text/plain") public String balance(@QueryParam("card") String card, @QueryParam("pin") String pin) { ... } ...
There also annotations for using HTTP POST (@POST) and specifying the data type that is consumes (@Consumes).
This example was taken from a Java ONE presentation.
No comments:
Post a Comment