Hi Keith, Did you know we have already ported those examples? Check the "org.restlet.example" module for source code.
Otherwise, the getEntityAsForm() method caches the result by default, so you could invoke it again later down the road. However, the Resource class doesn't know about that and from its point of view, the original entity isn't available anymore. One way to workaround this is to replace the Request's entity with the parsed Form: request.setEntity(myForm.getWebRepresentation()); Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -----Message d'origine----- De : Keith McDonald [mailto:keithmmcdon...@gmail.com] Envoyé : mardi 12 mai 2009 18:06 À : discuss@restlet.tigris.org Objet : Can a filter read entity non-destructively? To teach myself Restlet, I am trying to port the example bookmarking application from chapter 7 of Richardson and Ruby's "RESTful Web Services". In their example, they put "before" filters on their objects to check if the user whose information is being requested matches the user whose credentials were used to authenticate. It does this by looking at the user name in the entity. I tried to recreate this functionality in Restlet by creating a subclass of Filter called MustSpecifyUserFilter and reading the entity by calling getEntityAsForm inside the filter's beforeHandle method, but this causes the entity to be marked as unavailable and a 400 to be returned before my Resource code can process it (In my Resource subclass, I am only overriding storeRepresentation rather than handlePut). Should I give up trying to use Filters to recreate this functionality or is there another way such as overriding handlePut to ignore the "available" attribute on the entity? I am using Restlet 1.1.4. ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=22163 87 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2292412