Tim Peierls | 19 Dec 20:34 2014
Picon

Trouble going from 2.2 to 2.3

The default connectors for various editions have changed between 2.2 and 2.3 (actually between 2.3-RC1 and 2.3.0). JEE edition no longer registers HTTP or HTTPS server helpers; JSE still does.

Assuming this was intentional and not an oversight, the change causes problems for me. For several versions now I've been able to maintain one build that works both as a standalone deployment and when embedded in a WAR for deployment in a production server running Tomcat. I've used the JEE edition because of the dependency on org.restlet.ext.servlet.ServerServlet.

(Why use Tomcat at all? There are better connectors for production purposes. Short answer is that it plays well with AWS Elastic Beanstalk.)

With this latest change, however, the standalone deployment no longer works. I get message: No available server connector supports the required protocols: 'HTTP' Please add the jar of a matching connector to your classpath.

It's because no HttpServerHelper has been registered in these lines for JEE (the "jee" token was added to the #ifndef list only a few days ago). I'd be happy to add the jar of a matching connector if there was one that the JEE edition supported, but the obvious candidates, Jetty and Simple, don't seem to be available for that edition.

I'd be happy to switch to the JSE edition, but then I wouldn't be able to compile against org.restlet.ext.servlet.

There's an existing issue which is vaguely related:


I'm not filing my own issue yet, because I don't see it as a bug, but I'd like advice on what to do here. I'd prefer not to have to make separate builds -- it was a really nice property that I could run the same code and libraries either standalone or deployed as a WAR.

--tim
Jerome Louvel | 18 Dec 22:49 2014

Restlet Framework 2.3.0 released!

Hi all,

Check out the details about the new version here!

We also updated the technical documentation on the web site with better styling, a navigation bar in the user guide and more. The Javadocs area will get the update soon as well.

Thanks,
Jerome
--



Jerome Louvel | 29 Nov 08:52 2014

Restlet Framework 2.3 RC1 and 2.2.3 released

Hi all,

We have just released version 2.3 RC1 that will soon become our new "stable" version, as well a 2.2.3 that includes several bug fixes including a critical security fix for Directory. Please test and send any feed-back, 2.3.0 is planned for next week!

Recent changes in the 2.3 branch include:
  • support for SPDY via the Jetty 9.2 extension, 
  • automatic serialization of Java exceptions as HTTP error responses on both client-side and server-side via the <at> Status annotation, StatusService and ConverterService,
  • an enhanced APISpark extension including an API introspector for Restlet API/JAX-RS API/Jackson annotations as well as a firewall service with rate limitation (integration with APISpark is optional),
  • compatibility with GWT 2.7,
  • Jackson extension now configured to produce more compact JSON by ignoring null values by default,
  • update HTTP client connectors timeout default value to prevent connections to stay around forever if not consumed,
  • Swagger 1.2 & 2.0, RAML 0.8  support added and improved via dedicated extensions
Changes log for 2.3:

To download those version:
Koen Maes | 20 Nov 15:18 2014
Picon

"segment" router or subrouter

Hi

My Restlet application is now mapped in the web.xml to "/app" and "/app/*". I have a whole bunch of routes
setup underneath this base URL in a function called setupApp(router).

Now, I plan to refactor things a bit and I want to change my web.xml so *every* call is intercepted by Restlet
so "/*".

The existing routings like "/app/user/{userId}" must keep on working.

**Now I can manually add the first segment "app" to my existing routings so they keep on working. **

But there must be an easier way to do this. I expect something like this to work :

public synchronized Restlet createInboundRoot() {

  Router router = new Router(this.getContext());

  Router subRouter = new Router(this.getContext());
  router.add("/app/*", subRouter);
  setupApp(subRouter);

  // add new stuff to the router
  router.add("index.html", IndexRouter.class);

}

// existing code but now with first segment /app added ?
// in the original code, the main router is passed in
public void setupApp(Router subRouter) {

  subRouter.add("/user/{userId}", UserResource.class);
  subRouter.add("/user/{userId}", UserResource.class);

}

thx for the pointers ...

Koen

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3091593

Jerome Louvel | 19 Nov 00:54 2014

New Restlet web site and framework logo

Hi all,

We just released our brand new Restlet web site this morning, with a new visual identity and consolidating all our products, Restlet Framework, APISpark (GA today) and the Restlet Studio (preview) in one place: http://restlet.com

Here is also the new logo:



Note that some technical resources on the framework haven't been fully migrated yet, but no worry we are actively working on them as I write. Thanks for your patience and do not hesitate to report issue if they are not fixed by the end of this week.

We are also completing version 2.3 of the framework including some great contributions such as support for Swagger 1.2/2.0, RAML 0.8, Jetty 9.2 (client-side and SPDY), firewall with rate-limitation and more.

Stay tuned!
santosh pathak | 10 Nov 21:43 2014
Picon

issues with setting Timeouts in Restlet

hi,In one of my project,I am new to restlet. 
I am using 1.1.5 version and using it for consuming a REST web service. 

I tried creating a client and tried setting the socket and connect Timeout in the context

Client client = new
Client(Protocol.HTTPclient.getContext().getParameters().add("readTimeout","some value");
client.getContext().getParameters().add("socketTimeout","some value"));

None of the values that I set in context is recognized by restlet , I still see my thread waiting for response
from back-end for endless time. 

What are the right context paramteres, that are needed for connection timeout and socket timeout?
Appreciate help..

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3091082

Rob Elsner | 23 Oct 19:41 2014

Feeling stupid - client connection gets closed early when relaying from network

We are trying to relay a FileRepresentation, and downloading directly from the Restlet server works fine. 
I can do a manual cURL/wget and retrieve the whole file correctly.

However, when relaying the input stream through a Servlet it seems like the client socket is being reset.

			Representation rep = myClient.get(MediaType.APPLICATION_OCTET_STREAM);

			response.setContentType("application/octet-stream");
			response.setHeader("Content-Disposition", "attachement; filename=\"" + fileName + "\"");
			outStream = response.getOutputStream();
			inStream = rep.getStream();
			byte[] buffer = new byte[65535000];
			int read = inStream.read(buffer, 0, 65535);
			while (read != -1)
			{
				outStream.write(buffer, 0, read);
				outStream.flush();
				read = inStream.read(buffer, 0, 65535);
			}
			outStream.flush();
			response.flushBuffer();

What we end up seeing on the server:

Caused by: java.nio.channels.ClosedChannelException
	at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:135)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:326)
	at org.simpleframework.transport.Appender.write(Appender.java:343)
	at org.simpleframework.transport.Appender.write(Appender.java:322)
	at org.simpleframework.transport.Appender.write(Appender.java:297)

And I'm not sure what's going wrong with our client where the socket connection to the Restlet server is
being prematurely closed before the entire file has been transmitted.

Does anyone have any hints or suggestions?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3090366

Jared Davis | 23 Oct 02:35 2014

Restlet 2.2.2, Jetty 8.1, disable SSLv3

Hi,

What is the correct way to disable SSLv3 with Jetty 8.1?

I've tried disabledProtocols but it seems to have no effect.

    Server server = component.getServers().add(Protocol.HTTPS, ip, port);
        server.getContext().getParameters().add("keystorePath", keyPathname);
        server.getContext().getParameters().add("keystorePassword", storepass);
        server.getContext().getParameters().add("keyPassword",keypass );
        server.getContext().getParameters().add("disabledProtocols", "SSLv3");

Thanks,

Jared

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3090338

Ralph van Etten | 20 Oct 11:22 2014

PATCH on Android with SSL gives 'Scheme https not registered'

Hi,

I have an Android application which uses the PATCH method.
When using the standard connector I get:

Communication Error (1001) - The connector failed to complete the 
communication with the server
....
Caused by: java.net.ProtocolException: Unknown method 'PATCH'; must be 
one of [OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE] at 
java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:685)

So I use org.restlet.ext.httpclient and register it in my Android 
application:

Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

but now I get the following exception:

Internal Connector Error (1002) - The connector encountered an 
unexpected condition which prevented it from fulfilling the request
             at 
org.restlet.resource.ClientResource.doError(ClientResource.java:599)
...
      Caused by: java.lang.IllegalStateException: Scheme 'https' not 
registered.
             at 
org.apache.http.conn.scheme.SchemeRegistry.getScheme(SchemeRegistry.java:80)
             at 
org.apache.http.impl.conn.ProxySelectorRoutePlanner.determineRoute(ProxySelectorRoutePlanner.java:157)
             at 
org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:596)
             at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
             at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
...

What does it mean and how can I fix it?

It works fine if I use an http URL. It also works fine using the 
httpclient on JSE.

Thanks,

Ralph.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3090165

Himani | 15 Oct 20:11 2014
Picon

Cookie set in request not received at Restlet servlet end

I have a Test Client which makes Restlet Request as below : 

public class TestRestlet {
public static void main(String[] args) throws IOException {
    CookieHandler.setDefault(new CookieManager( null, CookiePolicy.ACCEPT_ALL ));
    ClientResource resource = getClientResource();
    Representation rep = resource.get();
    System.out.println(rep.getText());

}

private static ClientResource getClientResource() {
    String resouceURL = "http://localhost:8080/ActivitiSampleProject/service/process-definitions?suspended=false";
    CookieSetting cookie1 = new CookieSetting("USER", "qdny6HjWY0HONvWoyufBWemrDE+5IcdsssssK0E8UGmu5RKPF7h0BWKvBPSn+Kucb82Aq");
    cookie1.setDomain(".abc.com");
    cookie1.setPath("/");
    cookie1.setMaxAge(-1);
    ClientResource resource = new ClientResource(resouceURL);
    resource.getRequest().getCookies().add(cookie1);
    return resource;
}
}

At Restlet Servlet I want to read these cookies from request and send them back to calling client to fetch
some information based on the cookie.

But I am unable to retrieve the cookies : I have set my debugger at service method of
org.restlet.ext.servlet.ServerServlet and the request has no cookies.

public void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    .......
}
Is this the correct way to set cookies in request what am i doing wrong.?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3089938

Jerome Louvel | 15 Oct 15:13 2014

RE: Redirect whole browser traffic to restlet proxy

Hi Jovan,

Are you trying to setup a reverse proxy (server-side)?
If so, you need to set the mode to MODE_SERVER_OUTBOUND and use an URI template such as  "http://www.google.com/{rr}".

See Javadocs as well:
http://restlet.com/learn/javadocs/snapshot/jee/api/org/restlet/routing/Redirector.html

Best regards,
Jerome

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3089931


Gmane