Hi Michael,

In Restlet 1.1 (SVN trunk), we've added a cache mechanism so you can call
getEntityAsForm() several times.

If you have to stay in 1.0 for now, here is a work around:

   request.setEntity(request.getEntityAsForm().getWebRepresentation());

That should allow you to call getEntityAsForm() again in next
filters/restlets/resources.

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Michael
> Envoyé : mercredi 21 novembre 2007 19:55
> À : [email protected]
> Objet : request.getEntityAsForm snag (Spring, Restlet, Acegi)
> 
> Hi,
> 
> I am running into a problem I need your help with. We are 
> building a RESTful 
> Spring/Restlet/Acegi based application that uses a custom 
> session-like 
> mechanism to track user sessions between RESTful calls. The 
> session id is 
> passed via a POST parameter in every request.  We've 
> customized several Acegi 
> filters to work with this scheme.  The 
> contextIntegrationFilter retrieves the 
> session id from the request and verifies that the session is 
> valid.  Inside the 
> filter we make the following call:
> 
> String sessionId = request.getParameter("sessionid");
> 
> The problem is that once this call is made, the request input 
> stream is parsed 
> and by the time the request makes it to the restlet - 
> handle(Request request, 
> Response response) - the request.getEntityAsForm() returns an 
> empty form (all 
> the parameters in the request are lost).  Is there a way for 
> restlet Request to 
> extract form parameters after the request had been parsed? If 
> so, how?  If not, 
> what would be an alternative way of extracting sessionId 
> parameter inside the 
> filter without causing the request to be parsed?  I've looked 
> for ways of 
> making a deep copy of the request object, but this doesn't 
> seem plausable.  Any 
> suggestion will be appreciated!
> 
> Thanks a lot!
> 
> Michael

Reply via email to