Who uses the restlet framework in production

Standalone RESTful server and client with the Restlet Framework

Sometimes you need a REST server or client or both in Java. This can be implemented quickly with the Restlet Framework.

Either the whole sample project can be loaded from Github or these steps can be carried out:

First we set up a new Maven project in Eclipse and add these entries to pom.xml:

xsi: schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.wenzlaff.umgebung</groupId>
<artifactId>de.wenzlaff.umgebung</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>RestUmgebung</name>
<url>http://www.wenzlaff.info</url>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<restlet-version>2.3.10</restlet-version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<source>1.8</source>
<target>1.8</target>
<!-- Java Standalone -->
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>${restlet-version}</version>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet.ext.simple</artifactId>
<version>${restlet-version}</version>
<!-- Java Jackson unterstüzung um Objekte zu serialisieren -->
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet.ext.jackson</artifactId>
<version>${restlet-version}</version>
<!-- Testframework JUnit -->
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>

We do the standalone server with two classes:

packagede.wenzlaff. Umgebung;
importorg.restlet.Component;
importorg.restlet.data.Protocol;
* An example standalone server.
* @author Thomas Wenzlaff
publicclassStandaloneServer {
publicstaticfinalIntegerPORT = 6969;
publicstaticfinalStringHOST = "http: // localhost:" + PORT;
publicstaticvoidmain (String [] args) throwsException {
Threadt = newThread (newRunnable () {
StandaloneServer.start ();
System.err.println (e.getMessage ());
* The server with the main application.
* http: // localhost: 9696 / surroundings /
* http: // localhost: 9696 / environment / service
* http: // localhost: 9696 / environment / version
publicstaticvoidstart () throwsException {
Component component = newComponent ();
component.getServers (). add (Protocol.HTTP, PORT);
component.getDefaultHost (). attach ("/ environment", newEnvironmentTargets ());

And another class of Application inherit and specify the routes or the URLs:

packagede.wenzlaff. Umgebung;
importorg.restlet.Application;
importorg.restlet.Restlet;
importorg.restlet.routing.Router;
importde.wenzlaff. Umgebung.resource.InfoResource;
importde.wenzlaff. Umgebung.resource.MindmapResource;
importde.wenzlaff. Umgebung.resource.Um UmgebungResource;
importde.wenzlaff. Umgebung.resource.VersionResource;
* Handles all calls for the server.
* @author Thomas Wenzlaff
publicclassEmgebungsZieleextendsApplication {
* Generates the root restlet that processes all incoming calls.
* http: // localhost: 9696 / surroundings /
* http: // localhost: 9696 / environment / service
* http: // localhost: 9696 / environment / version
publicsynchronizedRestlet createInboundRoot () {
Router router = newRouter (getContext ());
router.attach ("/", InfoResource.class);
router.attach ("/ service", EnvironmentResource.class);
router.attach ("/ version", VersionResource.class);
router.attach ("/ mindmap", MindmapResource.class);

Then another EnvironmentResource create that from ServerResource inherits.

packagede.wenzlaff. Umgebung.resource;
importorg.restlet.resource.Get;
importorg.restlet.resource.ServerResource;
* Provides the system environment.
* @author Thomas Wenzlaff
publicclassEnvironmentResourceextendsServerResourceimplementsEnvironment {
publicStringgetEnvironment () {
return "Environment: \ n" + System.getProperties (). toString (). replaceAll (",", "\ n");

For this also an interface with class names Surroundings and the annotation @get invest:

packagede.wenzlaff. Umgebung.resource;
importorg.restlet.resource.Get;
* Interface for the environment.
* @author Thomas Wenzlaff
publicinterface environment {

That's all for the server. But we don't just want to test this via the browser. Therefore a client packed in a JUnit test class: