Walker Zhang | 16 Jul 04:11 2014

restlet gwt i18n problem(for Russian lang)

I'm using restlet-gwt to call web service on server. It works fine for locales like 'en' or 'fr', but the XHR
failed to be sent to server due to error in RequestBuilder when I switched to 'ru'. The headers map is:
{Host=localhost:8080, Date=Пт, 11 июля 2014 01:58:21 UTC,
User-Agent=Restlet-Framework/2.0.14, Accept=application/json} and the value for Date is causing
the following the error:
Caused by: com.google.gwt.http.client.RequestException: (TypeError): Cannot convert string to
ByteString because the character at index 0 has value 1063 which is greater than 255.
    at com.google.gwt.http.client.RequestBuilder.setHeaders(RequestBuilder.java:422)
    at com.google.gwt.http.client.RequestBuilder.doSend(RequestBuilder.java:386)
    at com.google.gwt.http.client.RequestBuilder.send(RequestBuilder.java:237)
    at org.restlet.client.engine.http.GwtClientCall.sendRequest(GwtClientCall.java:254)
    at org.restlet.client.engine.http.adapter.ClientAdapter.commit(ClientAdapter.java:92)
    at org.restlet.client.engine.http.HttpClientHelper.handle(HttpClientHelper.java:110)
    at org.restlet.client.Client.handle(Client.java:168)
    at org.restlet.client.resource.ClientResource.handle(ClientResource.java:697)

I'm using GWT 2.2 and Restlet-gwt 2.1.7
Please any help will be highly appreciated!

17:35:52.016 [ERROR] [welcomeportal] Uncaught exception escaped

org.restlet.client.resource.ResourceException: Internal Connector Error
    at org.restlet.client.resource.ClientResource.handle(ClientResource.java:623)
    at org.restlet.client.resource.ClientResource.handle(ClientResource.java:645)
    at org.restlet.client.resource.ClientResource.handle(ClientResource.java:593)
    at org.restlet.client.resource.ClientResource.get(ClientResource.java:418)
    at org.talend.mdm.webapp.base.client.rest.ClientResourceWrapper.request(ClientResourceWrapper.java:113)
(Continue reading)

Jerome Louvel | 15 Jul 21:15 2014

API World competition support

Hi all,

Our APISpark platform (based on Restlet Framework) is in 2nd position, not far from 1st, in the API Infrastructure category for the "API World" awards competition.

The winners will get great exposure (see this previous visual landscape from DevNetwork that put Restlet in a nice spot close to cool developer technologies) and free tickets to the event based in San Francisco.

I would really appreciate your support to get a boost to first place! The voting ends in less than 12 hours. If we win, all remaining extra tickets will be given out to interested supporters.

Frank Kolnick | 11 Jul 21:58 2014

unsupported media type

I get this error when issuing a PUT to a Restlet-based server.

Is there a way to tell Restlet to accept 'anything', i.e., all text-based content?


Frank Kolnick | 11 Jul 17:50 2014

Put with no content

A previous thread seems to indicate that this has been fixed, but I still get a "No Content" error when I send a
PUT to a Restlet-based server. (The client uses a library other than Restlet.)

I have the latest stable release of Restlet.

Is there a work-around? Preferably not one that requires inserting dummy content.


Tejas Dharamsi | 11 Jul 10:27 2014

Getting Started with Restlet

I want to use Restlet framework for making a rest api which will act as an interface for my java back end and
angular js front end.
Can you post an example which can help me move swiftly to  achieve my goals

I want data encoding in JSON.


do revert back at the earliest.



Frank Kolnick | 9 Jul 16:05 2014

Restlet client resource 'put' and threading

I have a simple Java app that uses Restlet to send messages to a remote server. A thread running in the
background has these lines of code:

ClientResource resourceHB = new ClientResource ( uri );    
resourceHB.put ( "heartbeat" );    

which works fine. I.e., the message is sent to the desired server.

However, I have copied the same lines to another thread (but using a different URI). Two things happened:

    at run time, I get a message that the protocol isn't specified, so, after some research, I changed the code to:

    Client client = new Client ( new Context(), Protocol.HTTP );
    ClientResource resourceFault = new ClientResource ( uri );
    resourceFault.setNext ( client );
    resourceFault.put ( "error" );

    that eliminates the protocol error, but the 'put' gets a 'bad request' HTTP error; the difference seems to
be that in the first case, the HTTP message is sent automatically as 'octet_stream' (which is what the
remote server expects) while in the second it is defaulting to 'html'.

My questions are:

    why do I have to add the extra code in the second case?

    how do I force the content type to be 'octet_stream'? I've tried:

    resourceFault.put ( "error", MediaType.APPLICATION_OCTET_STREAM );

    but Fiddler still shows the header with 'text/html'.

    again, why does the second case need so much extra information? -- the first case 'just works'

    is it not possible to have multiple client resources, particularly in different threads?

Java 1.6
Restlet version 2.2.1 for Java SE
org.restlet.jar (no extensions)

The main program uses:

import org.restlet.resource.ServerResource;
import org.restlet.Component;
import org.restlet.data.Protocol;
import org.restlet.routing.Router;

The thread containing the first snippet uses:

import org.restlet.resource.ClientResource;

The thread containing the second snippet uses:

import org.restlet.resource.ClientResource;
import org.restlet.data.Protocol;
import org.restlet.Client;
import org.restlet.Context;
import org.restlet.representation.StringRepresentation;
import org.restlet.data.MediaType;


AAlefeld | 27 Jun 14:51 2014

Put -> method not allowed


I am a newbie to restlet api and I started using restlet 2.2.1 and have 
a running restlet app with resources that can be accessed via GET 
request. They return a json string, e.g. localhost:8182/myresource   
gives a list like [ res1, res2, res3 ]

I wanted to add a put method now to store/modify a resource and added

 <at> Put
public void storeResource(JSONObject json) {
     System.out.println("Put resource: " + json);
     // real handling goes here

rebuilt and restarted the server

curl -v http://localhost:8182/create -X PUT -H "Content-Type: 
application/json" -d '{"res3": {"name":"test", "setting":"ud"}}'

I would expect to get the object printed out on the server side, instead 
I run always into:
< HTTP/1.1 405 Method Not Allowed
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Method 
Not Allowed</p>
<p>The method specified in the request is not allowed for the resource 
identified by the request URI</p>

In the javadocs I read something about the default implementation of put 
in Representation to always set

How can I achieve that my PUT/DELETE etc. requests are accepted ?

thanks for any help,


Davide Cavestro | 26 Jun 09:38 2014

Please also publish restlet artifacts in Maven Central

Accessing restlet artifacts from Maven Central would ease integration, without requiring users to add a
specific maven repo for restlet. I.e. in Grails projects maven central is available by default, but when
you develop a plugin that depends on restlet, then plugin users have to manually add the restlet repo into
their project.


Tim | 25 Jun 11:32 2014

Handling multiple environments


We have a legacy system comprising two servers and up to 5 different environments that look a bit like this:

TEST_SERVER --> Dev / Test / QA / Ref

So the TEST_SERVER has 4 environments and the LIVE_SERVER just the one. To add to the confusion, the servers
host both the RESTlet instances (under Tomcat) and the "backend" database, and the web apps are able to
connect to the databases of either machine. In other words, you can be accessing the HTTP server of the test
machine, but connect to the database of the live machine.

For reasons explained here
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3075356 I'm trying to
develop a system using RESTlet where the "model" is implemented using stored procedures on the back-end
system which can be mapped to URLs by configuration alone. The idea being that to implement some new
business logic a stored procedure is written and then a new URL template mapping to that procedure is added
to the configuration (and the app restarted to reload the routes). My RESTlet application provides the
glue between the stored procedures and the web and automatically maps the parameters in the URL template,
query parameters etc. to the stored procedure parameters prior to the call. The result from the stored
procedures is then used as the model for Freemarker tem
 plates to create the desired representation, according to the "accepts" header and the template provided
in the configuration for the stored procedure in question. 

Although it's very much at the prototype stage it seems to work very well so far (largely thanks to Tim's help
in the thread mentioned above!).

My problem is how best to deal with the multiple environments and especially how to make sure that relative
URLs stay relative to the correct environment. I suspect this would be a good case for virtual hosts, with a
separate VH for each environment like this:

http://{env}.TEST_SERVER:8080/ where "env" is the database/environment. This way I guess any URLs
relative to the root ref will point to the correct environment.

However, our network set-up doesn't allow me to use sub-domains, and that isn't likely to change, so I think
the only other approach I have is to do this:


In this case, I would like the URL above to become the root so that any relative URLs specified are always
relative this base part and it can be added to the Freemarker model to enable templates to generate URLs for
links etc. with the correct base.

I thought perhaps this could be done by chaining routers such that the initial root is this:


and have a restlet attached which changes the request's "rootRef" to the "resourceRef" and then chaining
the routers for the remaining part of the URLs after.

Would this work or is there a better way to approach the whole problem? Any ideas and suggestion would be very welome!!




Xybrek | 17 Jun 04:33 2014

Can Restlet work with Spring Boot

Before I go in a deep explanation, I just want to know if Restlet would 
work with Spring Boot? Much of the Spring samples I saw was not Spring 


Alagar | 16 Jun 21:51 2014

OSGi version of restlet jar

We are using Adobe CQ5 CMS for our project. The CMS uses  OSGi based Felix server. The server expects the jars
to be OSGi bundles instead of jars.

Can you help me / provide pointers to download the OSGi version of restlet-osgi-2.2.1