tags:

views:

19

answers:

1

my scenario:

  • large amount of JSP (about 3000)
  • not too much css files (about 100)

Today I have a lot of bundles that includes a couple of css files, as needed.
Then the jsp includes: or the bundles or the css files.

Is Jawr the best choice for me?

How do you handle you css files?

A: 

First of all, 100 css files is a very large number. It is important to reduce the number of http requests in order to improve performance. JAWR is a very good tool for this kind of scenarios. But you should be aware of the alternatives. One of them is called Web Resource Optimizer for Java or wro4j. It allows you to simplify the way you declare bundles (groups) or resources, for example:

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">

  <group name="all">
    <css>/thirdparty/css/single.css</css>
    <css>/static/css/*.css</css>
    <css>http://www.mycompany.com/asset/main.css&lt;/css&gt;
    <css>classpath:com/assets/from/classpath/app.css</css>
  </group>
</groups>

This xml defines the way you group resources, it shows that you can include resources from inside the servlet context of you app, from external links or from inside jar archives (classpath). Also you can use wildcards to avoid including resources one by one.

Alex Objelean
do you think is it stable enough to be used on a high traffic website?
Eridal
There is no reason why it wouldn't work for hight traffic sites. It's runtime solution uses a simple servlet filter and the result of compression is cached thus avoiding processing for each subsequent request. There is also a build-time solution available (as maven plugin) if you prefer build-time approach instead of a run-time.
Alex Objelean