dev@glassfish.java.net

Re: expires-header valve

From: w.rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Wed, 09 Jan 2008 23:13:27 +0100

Jeanfrancois Arcand wrote:
> Hi,
>
> w.rittmeyer wrote:
>> Hello,
>>
>> given the recommendations of Yahoo's Steve Sourders on website
>> performance I've been looking for a way to add expires headers to
>> images and css-files that are delivered by glassfish.
>>
>> Since I haven't been able to find anything I think a Valve might be
>> the way to go. Attribute would provide information about the amount of
>> time to add to the current time and about which content-type elements
>> to consider.
>>
>> Any thought about that?
>
> A Valve will works, but have you think about a Filter defined in
> ${glassfish.home}/domains/domain1/config/default-web.xml, which will be
> injected to any web application deployed under GlassFish. This way you
> can reuse your filter in other app server (hopefully not, but just in
> case).
>
> But for sure a Valve will works fine :-)
>

Well, granted, I haven't thought about this. Giving it some thoughts
though, I am not so sure about it yet.

Having been a long time Tomcat user I would consider Valves more
flexible - though of course more app-server dependent - compared to the
default-web.xml approach.

The default-web.xml configures the behaviour for all webapps of this
domain. A Valve though is configurable in the Tomcat world for Engines,
Hosts and Contexts respectively. In GF at least for virtual servers.
Though I am not sure about Valves for web-modules and http-listeners in
Glassfish.

Considering this I think using a Valve would be more fine-grained than
the default-web.xml while still coarser than a filter for each web-app.


But I will give it some more thoughts.

Thanks,

Wolfram Rittmeyer