[Yanel-dev] Browser side caching for content served by NodeResource

Michael Wechner michael.wechner at wyona.com
Wed Nov 10 09:15:54 CET 2010


On 11/10/10 8:45 AM, Balz Schreier wrote:
> Hi,
>
> static content is usually served by the out of the box Yanel Resource 
> "NodeResource".
> I did an audit (a feature available via Google Chrome Browser) that 
> tests a page and creates a little reports regarding potential 
> improvements.
>
> It says that all static content does not have an expiration date hence 
> some browsers may not use the cache and request all the little icons 
> on the page again and again with every request.

actually they should use the last modified, but I am not sure if the 
YanelServlet does
implement the 304 properly

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Please review

src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java

for 304
>
> Is the behaviour of the NodeResource as expected?
>
> I consider to extend the NodeResource so that you can configure it to 
> set some Browser Caching HTTP Header attributes.

please go ahead, but it means you need to re-factor this resource such 
that it writes its own response instead returning just a view (which is 
then processed by the YanelServlet).

This can be accomplished by using

http://www.yanel.org/javadoc/org/wyona/yanel/core/attributes/viewable/View.html#setResponse%28boolean%29

See for example

src/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java

Cheers

Michael
>
> Cheers
> Balz



More information about the Yanel-development mailing list