Restlet 1.1 - Integrations
Introduction
The Restlet framework is composed of three parts: the Restlet API, a reference implementation, called the Noelios Restlet Engine (NRE), and the optional Restlet extensions. The NRE enables you to simply build a complete Web application. However the NRE is open enough to leverage other open source projects to facilitate tasks such as generating dynamic representations, managing uploaded files, etc. The result of these integrations is packaged as Restlet extensions which offers pluggable features to the NRE.
This document will list these available extensions and describe how to add those extension to your application.
Available extensions
| Extension | Description | Version |
|---|---|---|
| ServerServlet | Integration with Servlet containers | 2.4 |
| FileUpload | Management of uploaded files | 1.2 |
| FreeMarker | Dynamic representations based on FreeMarker templates | 2.3 |
| JSON | Generation of representations based on JSON format | 2.0 |
| Spring | Integration with Spring Framework | 2.0 |
| Velocity | Dynamic representations based on Velocity templates | 1.5 |
Third-party integrations
| Integration | Description | Version |
|---|---|---|
| eXist | Integration with the eXist XML database | 1.0 |
| Facelets/JSTL | Integration with the Facelets and JSTL Core template standards | 1.0 |
| XMPP | Integration with the XMPP protocol | 1.0 |
Add an extension to your application
All extensions and their dependencies are shipped with the Restlet
distribution by the way of JAR files. Adding an extension to your application
is as simple as adding the archives of the chosen extension and its
dependencies to the classpath.
You can also have a look to the FAQ #4 and FAQ #5
which completes this subject.
ServerServlet
This extension is an adapter between the Servlet API and the Restlet API.It enables you to run a Restlet based application inside any Servlet container such as Tomcat.
Please, refer to the ServerServlet extension Javadocs and the FAQ #2 for more details.
Here is the list of dependencies for this extension:
FileUpload
This extension lets you receive files sent by POST or PUT requests. It relies on the Apache Commons FileUpload package which provides a robust, high-performance, file upload capability to web applications.
Please, refer to the FileUpload extension Javadocs and the FAQ #18 for more details.
Here is the list of dependencies for this extension:
FreeMarker
This extension provides the feature of generating Representations based on the FreeMarker template engine. FreeMarker is an embeddable tool that generates text output (anything from HTML to autogenerated source code) based on templates written in a simple template language that enables to reference Java objects passed to the FreeMarker engine.
Please, refer to the FreeMarker extension Javadocs and the FAQ #10 for more details.
Here is the list of dependencies for this extension:
JSON
This extension adds support for JSON representations. It enables you to create
JsonRepresentation instances from the two kinds of structure defined by JSON:
objects and arrays, and to make the reverse conversion. JsonRepresentations
can also be generated from String and any kind of Representation.
See JSON project for more details about the
JSON format.
Please, refer to the JSON extension Javadocs and the FAQ #10 for more details and have a look to the Restlet wiki for some sample code.
Here is the list of dependencies for this extension:
Spring
This extension is an injection of the Spring Framework into the Restlet framework. Historically, this extension emerged from the needs of Spring users, stuck between the Spring's mechanism of Dependency Injection mostly based on JavaBean setters (Setter Injection) and constructor arguments (Constructor Injection), and the conceptual choices of the Restlet framework that didn't systematize the use of simple POJOs. This extension aims at providing a better and more natural integration.
Please, refer to the Spring extension Javadocs and the FAQ #23 for more details and have a look the Restlet wiki for several sample codes.
Here is the list of dependencies for this extension:
Velocity
This extension lets you generate Representations based on the Velocity template engine. Velocity is an embeddable tool that provides a template language used to reference java objects passed to the engine. Any kind of text output (from HTML to autogenerated source code) can be generated.
Please, refer to the Velocity extension Javadocs and the FAQ #10 for more details.
Here is the list of dependencies for this extension:
eXist
Alex Milowski has developed a client connector for the eXist XML database. The integration lets you retrieve any XML document from an embedded database and also post queries. You can get the details at this address.
Facelets
Michael Terrington has developed XTC (XML Template Compiler), an XML templating tool based on Facelets, without JSF but with JSTL core support. The integration with Restlet is similar to Velocity and FreeMarker extensions and let's you generate representations dynamically. You can get the details at this address.
XMPP
Alex Milowski has also developed client and server connectors for the XMPP protocol letting you easily develop smart instant messaging applications. The integration is available via his Xeerkat open source project. You can get the details from a post to the Restlet mailing list.