Struts2 Static Content

November 6, 2009

In the Apache Struts2 Documentation Performance Tuning page one of the recommended tips for improving the performance of the framework is to avoid Struts serving the static content.

Struts tags and themes include a set of static resources – javascript libraries, CSS, Freemarker templates – which are included inside the Struts jar file. The framework, via a filter (org.apache.struts2.dispatcher.FilterDispatcher which then delegates to a “staticLoader” class), retrieves those resources from the jar files (unjar them on the fly) and serves them on request.

Although this works quite neatly – nice to have all classes and resources contained together – it adds an unnecessary overhead upon serving the http request.

Read the rest of this entry »