Define Entity:
- Identification of resources
- Entities have uniform names
- Every entity has its own name and uniform location
- An Entity is anything that can be individually named
- Most database tables are logically entities, but usually a RESTful entity includes much more data than just a single row
- Entities get URLs
- Access the current state of that entity using that URL
- Change the state of that entity using same URL
- Entities have relations between them
- Most clearly represented as hypertext
- Nothing stops you from delivering related entities with each other
- Can deliver groups of entities at once, either as hypertext lists or as batches of actual content
- Manipulation of resources through these representations
- Use A Limited Set Of Verbs
- HTTP Put, Get, Delete, Post all you need for CRUD operations
- HTTP is the most prominent, but FTP, SMTP, JMS, HTTP, Directory Scanning can all be used
- HTML, JSON, CSV, FIX, XLS
- Self-descriptive messages
- Use Content Negotiation
- Client says what it can support, server gives it the best match
- XML excellent for RESTful integration
- Use of tooling or hand parsing using XPath or DOM walking
- HTTP excellent protocol
- Client-initiation helps satisfy HATEOAS principles and avoid pumping data into the ether
- Can use huge set of HTTP based assisting technologies
- Everything speaks it
- Any language which can’t process XML over HTTP will be extended or replaced by one which does
- Solves the Excel problem
- HATEOAS Principal - Hypertext As The Engine Of Application State
- Client applications navigate through links
- Clients never assume anything about the internal structure of the application beyond the defined content encoding
- In particular, “deep-linking” should be avoided wherever possible!
- Don’t store client context or state on the server, keep it with the client
- Resource providers don’t know anything about how a client is navigating through the application, so can scale better
- Allows providers of resources to manage them
- Can change hosts, protocols, encodings based on client and configuration details without clients having to be updated
- If your application has a single URL that defines entry to the system, yer doin’ it right.
Reference implementation
- CXF - which is a merger between XFire and Celtix (an Open Source ESB, sponsored by IONA and originally hosted at ObjectWeb).
- Jersey - JAX-RS Reference Implementation from Sun.
- RESTEasy - JBoss's JAX-RS project.
- Restlet - probably the first REST framework, which existed prior to JAX-RS.
- Jersey is meant as a reference implementation.
- RESTEasy is a playground for new ideas.
- CXF has an "enterprise version" supported by IONA.
- Restlet project grew out of a desire to have a RESTful API alternative.
0 comments:
Post a Comment