Thanks for sorting me out, Chuck ...

> First, I'm not sure I understand why you'd call
> getEntityAsForm() if the params are in the URI. 

Retracted.  You wouldn't.  getResourceRef().getQueryAsForm() is what one would 
use in this case, and it does not have any destructive side effects on the 
Entity.  I was just trying to work through the implications of the 
transient/available stuff that came up yesterday and constructed an example 
that turns out to be largely bogus.  Duh.  I've just demonstrated that despite 
being up to my knees every day in Restlet guts lately, I also am a Restlet 
newbie!

> First off, some messages can be really large and you'd
> rather stream them directly to a file rather than trying
> to cache them in memory ...

Yes.  For example, naively calling something like getEntityAsDom() can indeed 
expose your application to a brutal denial of service opportunity when someone 
starts PUTting hundreds of MB of XML for fun and giggles.

I also agree that it's hard to make any sort of framework-level caching general 
enough to work in all cases ... and if you make something that has cache tuning 
features galore, most users won't be able to grok, let alone frob, all the 
necessary  features in order to get satisfactory results.  (cough) Hibernate.

I guess the operational rule that probably applies here is that a well-behaved 
Filter, Router, Guard -- or any other intermediate Restlet other than a 
Resource or something that serves up resources -- should work very hard to 
avoid touching (even reading) the Entity.  This is probably a good rule both in 
terms of architectural style and also the simple network reality -- as you 
point out, once you get the bits out of the stream or channel, you can't put'em 
back.  If an intermediate Restlet has to touch the Entity, everything 
downstream of it needs to be aware of any potential side effects and how to 
recover from them (e.g. to get a cached representation from wherever it has 
been stowed).  If one is building intermediate Restlets meant to be reusable 
without downstream knowledge, this isn't an option.

- R

Reply via email to