Hi Paul,

On Apr 6, 2009, at 11:45 AM, Paul Austin wrote:

> I am using the RestletFrameworkServlet with the SpringBeanRouter to  
> serve up resources. The resource in question will return a static  
> file within a web application.
>
> I noticed that the images on a web page served by this resource  
> return the incorrect image. So added a log statement in the init  
> method and in the represent method. This debug prints out the  
> instance of the resource and the image being requested. As you can  
> see from below the same resource instance is being used multiple  
> times (@99bc71) and in the last few you can see that there is a  
> threading issue as two requests overlap and the request for the  
> blu_top.gif image is actually returning the crumbs.gif image.
>
> According to the docs resources are not shared so don't have to be  
> thread safe (i.e. can contain state).
>
> Does restlet re-use the same resource instance for multiple requests  
> in the same thread? What happens if the browser uses a persistent  
> HTTP connection?

Do you have your application context set up to use scope="prototype"  
for your Resource beans?  If you don't, Spring will default to  
creating them as singletons, which would explain the behavior you see  
here.

Rhett

> com.revolsys.restlet.staticwarresou...@e9df24:http://localhost:8080/ws/css/bcgov.css
> com.revolsys.restlet.staticwarresou...@38e7bb:http://localhost:8080/ws/scripts/ws.js
> com.revolsys.restlet.staticwarresou...@e9df24:/css/bcgov.css
> com.revolsys.restlet.staticwarresou...@38e7bb:/scripts/ws.js
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/bc_sun_logo_horiz.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/ 
> bc_sun_logo_horiz.gif
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/icon_help.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/icon_help.gif
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/left_blue_arrow.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/ 
> left_blue_arrow.gif
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/nav_grey_bottom.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/ 
> nav_grey_bottom.gif
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/blue_top.gif
> com.revolsys.restlet.staticwarresou...@99bc71:http://localhost:8080/ws/images/crumbs.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/crumbs.gif
> com.revolsys.restlet.staticwarresou...@99bc71:/images/crumbs.gif
>
>
>
>
> Paul Austin
> President/CEO
> Revolution Systems Inc.
>
> +1 (604) 288-4304 x201
> www.revolsys.com
>

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

Reply via email to