Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Find out what makes the JavaBeans Activation Framework a perfect vehicle for RESTful data transmission, then put JAF to work in a sample Web application that tracks requests and responses through a Java Servlet-based system.
Representational State Transfer, also known as REST, is a style of software architecture defined by a collection of architectural principles. REST is applied specifically to such distributed systems as the Web, and stipulates mechanisms for defining and accessing resources. The term, originally described in a dissertation by Roy Fielding, often is used to describe any framework that transmits data over a protocol, such as HTTP, without additional semantic layers or session management.
The goal of REST is to simplify the implementation of actors in a client/server system by maintaining a strict separation of concerns. REST also seeks to simplify communication semantics, thereby improving performance and increasing the scalability of server components. REST relies on stateless interaction between requests, in which various media types are exchanged using standard message verbs.
REST can be implemented for the HTTP protocol using the Java programming language and JAF. In this article I introduce the basics of REST and JAF, then walk you through a REST implementation using JAF.
Note that Sun provides binaries of a JAF reference implementation that can be used to develop JAF components and clients on any Java 2 Standard Edition platform Version 1.4 or later.
In a REST implementation, resources, such as items in a shopping cart, are addressed via uniform resource identifiers (URI). A given URI is used to access the representational state of a resource, and also to modify that resource. For example, let's say a widget manufacturer uses REST to make its widgets available for consumption. At any given time, the manufacturer can present Web URLs containing descriptive information about the widgets. Widget consumers then need to know only a widget's URL to read the information. If authorized, the consumer also could modify the information as needed. The following illustrates a typical REST URI:
http://www.example.com/widgets/foobar/E4456SE321DAACF567
Notice how the URI defines the location of the "foobar" widget without stipulating an action to take. This is the goal of a URI in REST -- to represent a resource with a URI and to leave action semantics up to the underlying protocol.
One of the defining principles of REST is to exploit already existing technologies and Web protocols, in particular, HTTP. This makes REST simpler to use than other Web-based message processes, such as Simple Object Access Protocol (SOAP). A REST implementation requires no additional overhead to provide or consume information. According to Fielding, a REST-based conversation is stateless between requests, thereby supporting such subscription-based technologies as RSS, in which Web-site content is described and delivered to interested clients.
REST is an abstraction of fundamental architectural entities within a distributed system. REST defines these entities as follows:
Figure 1 illustrates some of the entities of REST and how they might participate within a simple enterprise system.
In a system like the one above, connectors would be embodied as ports to enable communication among the components over each given protocol. Also note that any component can have multiple client and server connectors to handle communication between itself and other client or server components.