Restlet with Apache HTTP Client does not deal well with followingRedirects

2011-05-17 Thread Tal Liron
Sigh, it's been a long two days.

The bottom line is that if you use Client or ClientResource over the 
Apache HTTP Client, you better not use followingRedirect=true, or else 
you'll get hanging threads due to connections not being returned to the 
Apache Client's connection pool.

The issue is that Restlet (2.0.7) executes an additional GET request for 
the redirect, but does not release the representation for the first GET 
that contains the redirect response.

You can reproduce this easily by trying more than 10 GET requests to 
http://google.com/; (which will redirect you to 
http://www.google.com/; and return an entity). After 10 requests, your 
Restlet Client class will hang. :/

I hope this gets fixed and can be merged into the 2.0 branch! My 
deployments are not yet ready to shift to 2.1. In the meantime, use my 
simple (if annoying) workaround: setFollowingRedirect(false). You will 
have to handle redirects via your own logic.

(After a few wild goose chases, I now know far, far more than I ever 
wanted to know about the internals of the Apache HTTP Client. Its 
architecture is actually similar to Restlet's in many ways!)

And ... you're welcome.

-Tal

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


RestletFrameworkServlet - HTTP 500 on first request.

2011-05-17 Thread Crogdor
Hello - I'm running Restlet 2.1-M4 (JEE edition) with the Spring extensions
on Tomcat 7/JRE6.  I'm using Spring 3.0.5-RELEASE.  I've also reproduced
these results with Restlet 2.0.7 and Spring 3.0.1-RELEASE.

I'm receiving an HTTP 500 error error the first time I call my Restlet. 
Subsequent calls succeed, however, as do calls after a server restart - it
only happens with a newly deployed WAR for some reason.

The server log shows one of the following two errors - it's pretty
arbitrary, but I definitely see the first one more often:

17-May-2011 1:27:01 PM org.restlet.engine.CompositeHelper handle
SEVERE: The org.restlet.Application class has no Restlet defined to process
calls. Maybe it wasn't properly started.

17-May-2011 1:48:34 PM org.restlet.routing.Filter doHandle
WARNING: The filter org.restlet.engine.application.StatusFilter@16f8789 was
executed without a next Restlet attached to it.

I believe my servlet are router are defined correctly, as subsequent calls
succeed:

servlet
servlet-nameMyRestlet/servlet-name
   
servlet-classorg.restlet.ext.spring.RestletFrameworkServlet/servlet-class
load-on-startup1/load-on-startup
/servlet

bean id=root class=org.restlet.ext.spring.SpringRouter
property name=attachments
map
entry key=/item
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=create bean=itemResource/
/bean
/entry
/map
/property
/bean

It's interesting that it only occurs for a new deployment - perhaps
something is resolving the issue behind the scenes and caching the results.

Has anyone else experienced this, or know of a solution?

Thanks!

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/RestletFrameworkServlet-HTTP-500-on-first-request-tp6375129p6375129.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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