This framework was designed as a lightweight REST-based Java framework with pluggable extensions for
different functionalities. At a high level, the Restlet Framework consists of three
parts:
- The Restlet API
- The Noelios Restlet Engine (NRE) implementing the API
- Optional Restlet extensions
An extension is available as part of the Restlet Framework that implements the JAX-RS
specification, providing all of the JAX-RS features you've come to know and love.
The Restlet Framework has always been protocol independent to a large extent,
and this has enabled it to be run under different deployment configurations,
including stand-alone JAR files, servlet containers, Spring containers, and
Google Web Toolkit. The Restlet Framework also supports its own XML-based
configuration apart from being able to leverage Spring XML configuration
mechanisms.
Client API:
Restlet includes a client API that makes it easy to consume any remote
HTTP-based services, not just JAX-RS services. The Restlet Framework is
based on a connectors and components architecture, where a connector
enables communication between components, usually by implementing a
network protocol. By instantiating an object of the
org.restlet.Client
class specific to the protocol
needed, you can invoke remote HTTP services.
Interceptor framework:
The Restlet Framework uses a sophisticated router-based mechanism to route
URI calls within the application. A router is a Restlet or a resource that
associates a URI to the resource that handles all requests made to this URI.
By extending the abstract class
org.restlet.Filter
and attaching it to an existing
router, it's possible to intercept calls to routers. Filters support some
processing before or after the handling of a call by a target Restlet.
Below example illustrating the default usage of a
router. It declares two routes—one associating the URI
/books
to
the resource BooksResource
and the second one /books/bookName
to the
resource BookResource
.
Restlet router creation:
// Create a router Restlet that defines routes. Router router = new Router(getContext()); // Defines a route for the resource "list of Books" router.attach("/books", BooksResource.class); // Defines a route for the resource "book" router.attach("/books/{bookName}", BookResource.class); |
Data formats:
The Restlet Framework supports major data formats like XML, JSON, and Atom
using extensions to its core framework. The Restlet extension for Atom
provides a comprehensive Atom API for both feeds and publication. The API
is capable of parsing and formatting Atom and APP XML documents.
Component integration:
With its extensive extension library, the Restlet Framework provides integration
support with various different frameworks and standards like Spring, Jetty,
Grizzly, Simple, JAXB, JAX-RS, JiBX, Velocity, and FreeMarker.
No comments:
Post a Comment