Hello Tim, I'm sorry for my very late answer. You can also wrap the response's representation into a custom one that aims at applying the minification process. You can have a look at the Encoder filter, especially in the "encode" method which uses an EncodeRepresentation.
Best regards, Thierry Boileau Perfect, thanks! > > --tim > > > On Wed, Jul 28, 2010 at 7:43 PM, Tal Liron <tal.li...@threecrickets.com>wrote: > >> I've handled it differently for Prudence: I create static >> unified/minifed files on-the-fly to be served via a Directory. If you >> request "all.min.js", all .js files in that directory are unified (in >> alphabetical order) and minifed. The filter can detect if any of the >> source files has been updated, and the interval between such tests can >> be configured. >> >> This seems to me the best way to go because the case for serving static >> files has already been optimized. (Other static web servers/CDNs can >> easily be used instead of Restlet's Directory.) >> >> See the code in JavaScriptUnifyMinifyFilter (LGPL): >> >> >> http://code.google.com/p/prudence/source/browse/#svn/trunk/java/com.threecrickets.prudence/src/com/threecrickets/prudence/util%3Fstate%3Dclosed >> >> There's also a similar class for CSS. >> >> (There might be an issue with method and concurrent file locking on >> certain operating systems -- haven't done a lot of testing yet, but I'm >> sure that case would be easy to fix.) >> >> -Tal >> >> On 07/28/2010 05:27 PM, Tim Peierls wrote: >> > I wrote a Restlet Filter to minify application/x-javascript resources >> > in afterHandle (using JSMin now, but I'll probably switch to YUI >> > Compressor). >> > >> > But is that all I can do with it? It feels as though this should be >> > plugged into the TunnelService, with ways to take requests for >> > foo.min.js, say, and return a minified foo.js, with caching and all >> > those goodies, yet still return plain, unminified foo.js when it's >> > requested. >> > >> > Feels like this must have been done already, but I can't find >> > anything. Pointers? Advice? >> > >> > --tim >> > >> >> ------------------------------------------------------ >> >> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2639913 >> > > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2652094