We are still in migration process.
We have moved all the documentation from the old site to the new one.
The old documentation is still available as an archive file in the download section : http://java.net/projects/jawr/downloads
If you find any broken link, please leave a message on the discussion forum about it.
Sorry for the inconvenience.
Jawr is a tunable packaging solution for Javascript and CSS which allows for rapid development of resources in separate module files.
Developers can work with a large set of split javascript files in development mode, then Jawr bundles all together into one or several files
in a configurable way.
By using a tag library, Jawr allows you to use the same, unchanged pages for development and production.
Jawr also minifies and compresses the files, resulting in reduced page load times.
Jawr is configured using a simple .properties descriptor, and aside of standard java web applications it can also be used with
Facelets and Grails applications.

It is common knowledge that it is faster to serve one large file rather than two smaller ones, because of increased HTTP negotiation and the fact that most browsers only keep two connections open to the same host at any given time. Jawr will reduce the number of requests needed to load a page and the amount of data to transfer to clients, achieving drastic improvement of loading times. With a simple configuration file, resources can be distributed in bundles to best suit the usage pattern for a site. Files not added to bundles also benefit from minification and compression (if no bundles are declared, Jawr will work as an easy to configure resources compressor).
A JSP tag library (Facelets also supported) is used to import the resources to pages. In development mode, the tags generate <script> and <style> links for each resource mapped to a bundle. In production mode, the tags generate a single link pointing to the bundle file. Thus, there is no need to change code in pages when switching from development to production mode.
There is an increasing trend towards richer client interfaces with complex javascript implementations. Using Jawr will ease the development process by allowing to distribute modules in separate files without worrying about how the application will be served to clients.
The alternatives to using Jawr are:
- Developing all-in-one script files which conform to the deployment scheme. That is, cram all the modules into a few files. Version control becomes unmanageable and it is hard to find a component that needs change. As the project grows, the code becomes near to impossible to mantain.
- Use a build script to join and compress the files, which forces developers to build and redeploy the whole application for testing even the slightest of changes in their code.
Jawr offers the best of both worlds, by combining a powerful bundling-minifying-compressing scheme for optimal service in production, with a rapid development mode for quick change-save-test cycles.
You can download the latest release of Jawr
here. Also, check out the
quick start tutorial to see how easy it is to use Jawr in your project.
And don't forget to check the FAQ - Howto page for tips and troubleshooting.
Features
- Free and open source: Released under an Apache 2.0 license, Jawr can be used free of charge with or without modifications, for both commercial and noncommercial purposes.
- Easy to setup: All you need to start using Jawr is to declare a couple of servlets in you deployment descriptor, create a simple .properties configuration file, and use the Jawr tag library to import css and javascript resources to your pages. A complete setup takes a matter of minutes and requires little or no modifications over time.
- Lightweight: Bundling and compression is done once at server startup so there is no overhead to requests. Also, a cache component is available and enabled by default to serve resources directly from memory instead of from the filesystem.
- Built-in minification and postprocessing: Jawr includes JSMin and the YUI compressor, both from Yahoo!. A custom minificator for CSS is also included, although the YUI compressor can be used for CSS too. For each bundle, a customizable postprocessing chain is executed during startup. Relative URLs in CSS files are rewritten by a postprocessor so they keep working with a different relative path. It is also easy to create custom postprocessors to perform any modifications to your js and css files at deploy time. Learn more.
- Third party frameworks integration: Jawr can be used with DWR, Spring, JSF, Facelets, Wicket, Commons Validator (with Struts), and Grails. It can also be easily plugged into your own infrastructure.
There are many more features, check the features list page for a full listing.
Requirements
You can use Jawr with any compliant Java Servlet 2.3 or higher container implementation (i.e. Tomcat, Jetty, BEA Weblogic etc.), as long as the virtual machine it runs on is 1.4 or higher. Jawr uses Apache log4j for logging messages, so it is a required library. There are no other requirements, although if your JVM version is 1.4, you can improve performance by using the backport-util-concurrent library, which can be found at: http://backport-jsr166.sourceforge.net. However, this is completely optional and Jawr will work just fine if you choose not to use it.
Announcements
Here are the latest announcements regarding Jawr. You can find older version announcements with all the features that have been added over time at the change log.
- 08/15/2010: Version 3.3.3 released:
This version contains 2 bug fixes including a major one. It is highly recommended to upgrade to this version.
There was an issue in the hashcode generation, which causes the bundle to be reloaded even if the bundle content didn't change. This implies some performance penalties.
The hashcode was based on the Java object ID instead of the bundle content.
The consequences are :- If you restart your application server, for the same application, Jawr could generate different hashcodes for the same bundle.
- If you are using load balancing and run the same application on 2 servers, they could generate different hashcodes for the same bundle.
- Issue #160 fixed: An exception is thrown, when using JMX on an application whose the context path is empty
- Issue #163 fixed: Issue with bundle hashcode generation which must be based on bundle content Thanks to Mark W. for reporting the hashcode generation issue.
- 07/20/2010: Version 3.3.2 released:
This version contains only bug fixes.
Fixed issues:- Issue #157 fixed: NullPointerException thrown in BrowserResolver when no user agent found in HTTP header
- Issue #159 fixed: Space in the dependencies configuration lead to omitted dependencies Thanks to zafo and Trygve Lie for reporting these issues.
- 06/29/2010: Version 3.3.1 released:
This version contains a lot of new features and bug fixes.
New features:- One of the big new features of this release is the ability to define variant bundles. A variant bundle is the generalization of what already exists for the locale aware bundle. A variant bundle is a bundle which can change depending on some defined criteria. This means for example that you can define a specific bundle content by browser type. You can define a specific bundle for IE, and for the same bundle sent another content to Firefox, Chrome, Opera... For more information about the variant bundle, please check the following variant bundle documentation for more detail.
- One of the feature derived from the use of variant bundle is the support for CSS bundle skin. Jawr allows you to define CSS bundle, where the skin variant will be sent back to the user depending on the skin used by the user. The user skin is defined in a cookie. The good news is that the CSS skin can also be combined with the user locale, which means that Jawr is able to sent to the user the CSS bundle depending on the user skin and also depending on the user locale. For more information about how to use the new skin feature, please check the following Jawr skin documentation for more detail.
- The Jawr CSS tag has been updated to be able to generate title and alternate attributes for CSS bundles. The Jawr CSS tag has also been updated to be able to generate alternate for CSS skin bundles. Look for the CSS tag at the tag library doc for extra info.
- The Jawr skin swicther javascript generator has been created to generate the javascript file for the skin switcher. You can take a look to the generators documentation for more info.
-
Jawr now supports base64 image encoding.
Jawr is now able to generate base64 encoded image in your CSS bundle using a new postprocessor.
Please check the tutorial on how to use Jawr to generate base64 image in CSS bundle for more detail.
The Jawr image tags have been updated to be able to generate base64 encoded image. Please check the documentation on the taglib description for more detail. - Jawr supports hashcode bundle generator. This means that you can now define your own implementation of the id used to identify the bundle.(Ex: application version based, ...) For more detail, about how to implement your own hashcode bundle generator, take a look at the documentation about hashcode bundle generator.
- Jawr provides also an MD5 hashcode bundle generator, which use MD5 to create the bundle hashcode. Take a look at the documentation about hashcode bundle generator.
-
Jawr introduces the strict mode. For earlier version, Jawr didn't take in account the hashcode of the requested bundle.
This means that if a user request a bundle, for which the hashcode is different from the current one, Jawr will sent back the current bundle.
This may be an issue if you are using an application on a clustered environment. If you deploy a new version of your application on one server, while the other is still up. You can face cases where the user request a page on one server, and try to retrieve the web resource bundles one another.
This may lead to strange behaviors.
To overcome this issue, Jawr introduces the strict mode. In this mode, Jawr will allow you to define how you want to handle such requests by defining your own IllegalBundleRequestHandler. Jawr also provides a default implementation whch returns a "404" if it receive a such request. Take a look at the documentation about strict mode and illegal bundle request handler. Jawr provides just a default implementation, if you want to contribute and share your own implementation with the community, feel free to create and attach a patch in the issue tracker. -
Jawr supports composite bundle postprocessors for bundle and for the unitary files.
You can take a look to the postprocessors documentation for more info. - Jawr uses now alphabetical ordering for bundle resources by default.
- Jawr supports media keyword in CSS Import PostProcessor. Please check the CSS import postprocessor documentation for more detail.
- Jawr introduce a new postprocessor to combine CSS media. Please check the CSS combine media postprocessor documentation for more detail. Thanks to Gerben Jorna for the implementation of this feature.
- Issue #41 fixed: Add title attribute to style tag
- Issue #127 fixed: Problem parsing jawr-jsp2x.tld in Resin
- Issue #132 fixed: CSS image URL not written properly for generators which don't handle CSS images
- Issue #133 fixed: Issue on Jawr context management for debug mode and JMX in the JawrSpringController
- Issue #134 fixed: In debug mode, Jawr generates wrong CSS image paths for generated Css resources when using JawrSpringController
- Issue #139 fixed: Jawr don't handle *.ico files as image files
- Issue #141 fixed: Issue on Jawr CssMinifier which doesn't handle properly CSS rules with linefeed inside
- Issue #144 fixed: NPE when using jawr.debug.ie.force.css.bundle=true and ieonly.condition bundle property.
- Issue #145 fixed: Jawr not compatible with Java 1.4.
- Issue #146 fixed: ThreadLocal memory leak when reloading application.
- Issue #151 fixed: The Wicket image tag rendering is not working properly for HTML images
- Issue #152 fixed: For the image tags in Wicket, Jawr doesn't handle properly the URL generation of generated images Thanks to eliotsykes, mkkoch, wangg3, Martin Jönsson, jnichols959 and all those who participate through the discusion forum for reporting issues and giving feedbacks.
Thanks also to Gerben Jorna for his implementation of the combine media post processor and for the base implementation of the base64 CSS image postprocessor.
Jawr ant task and maven plugin - Version 1.4 released:
This version contains one new feature and one bug fix.
New feature:
- For IE6 and IE7 CSS bundles which use the new base64ImageEncoder, the bundle processor generates a placeholder for the web application URL. Please take a look to the following documentation for more detail.
- Issue #142 fixed: Add support to generate exact path mapping for Jawr bundle processor .
Jawr Grails plugin - Version 3.3.1 released:
We are happy to finally provide to the Grails community the latest Jawr Grails plugin, which is fully compatible with all the new features of the Jawr 3.3.1 version. We also would like to apologize for the discontinuation of the plugin release.
We are sorry for the inconvenience made to the Grails users, which where not able to use Jawr. We hope that you will enjoy this new version with all the latest features of Jawr.
The Grails plugin 3.3.1 is available here.
It will be soon available at the grails plugin repository.
New feature:
- Compatible with Grails version > 1.2.1
- Fully compatible with Jawr 3.3.1.
- Issue #68 fixed : jawr.config.reload.refreshKey fails on the Grails plugin
- Issue #130 fixed: In develpment Since Grails 1.2, Jawr can't reference pluing resources
- Issue #148 fixed: Since grails 1.2, Jawr is not able to generate i18n messages
- Issue #149 fixed: Since grails 1.2, Jawr is not able to generate i18n messages
The following Jawr sample applications have been updated. You can have a look to them to see how to integrate the latest features :
- basicwebapp
- spring sample
- wicket sample
- grails sample
Important note :
It is important to notice that this version will be the last version which supports Java 1.4. The next major release will target Java 5.
Thanks to all of you who contributed and provided feedback in the discussion forum.
There still a lot to do. So any contribution is more than welcome.
If you want to be part of the Jawr project, don't hesitate, join us.
This version contains mainly bug fixes.
New feature:
-
For spring MVC projects, Jawr now allows you to use simultaneously configuration and configLocation properties.
The values found in the configuration file at configLocation will be overrided by the properties defined in configuration.
The configuration property is no more deprecated. Thanks to sfrancois99 and szeller for their feedbacks.
Please check the documentation on the Spring MVC integration for more detail.
- Issue #81 fixed:jawr.[type].factory.dirmapper.excluded property doesn't work.
- Issue #113 fixed: In spring MVC, when using only configuration property an exception is thrown.
- Issue #115 fixed: Css image sprite generation doesn't work for generated CSS resource.
- Issue #118 fixed: Image Streaming throws exception if the browser closes the stream
- Issue #123 fixed: Images are not handled property with JawrSpringController.
- Issue #124 fixed: The property "factory.use.orphans.mapper" is never taken in account. To be compliant with the Jawr properties naming convention, this property has been renamed to jawr.factory.use.orphans.mapper. Please check descriptor syntax doc for more detail.
- Issue #125 fixed: In Spring MVC, an exception is thrown when the controller mapping is defined while the Spring servlet mapping is set to "/*". Thanks to qxo, mahoney266 and Robin Sander for reporting issues.
Jawr ant task and maven plugin - Version 1.3 released:
This version contains only one bug fix.
Fixed issue:
- Issue #116 fixed: Jawr bundle processing with the maven plugin or ant Task doesn't work with a spring MVC project. Please check the bundle preprocessing documentation for more detail. Thanks to acklenx for reporting the issue.
A serious security issue has been found in Jawr when using the property jawr.debug.overrideKey, which allowed a user to access the content of the WEB-INF folder, and any file of your web application if the user finds the value of the property jawr.debug.overrideKey, which is defined your configuration file.
This issue is fixed in this new version.
We highly recommend you to switch to this new version or at least to remove this property from your configuration file if you want to stay with a previous version. The recommended way to switch your current session from production to debug, is to use the JMX feature of Jawr. Please check the JMX documentation for more detail.
For those, who have created their own resource generator, we recommend them to look at the security issue section of the generator documentation
New features/ fixed issues:
-
Jawr supports the generation of CSS image sprites. Jawr uses smartsprites for the sprite generation.
Thanks to Stanislaw Osinski, smartsprites creator, for his help on the integration of Jawr with smartsprites.
Please check the tutorial on the image sprite generation with Jawr for more detail. -
Jawr now provides a new property named dependencies, which allows the user to define the dependencies for a bundle.
Thanks to kgray for the original idea.
Please check the bundle definition document for more detail. -
Jawr now provides support for Wicket, thanks to a patch submitted by Robert Kopaczewski.
Please check the Wicket integration document for more detail. - The generator API has been enhanced. Now you can create image generators, locale aware generators and generators, which support directory mapping. Please check the advanced generators document for more detail.
- Jawr provides an new API for global preprocessor. The global preprocessors are executed before the standard resource bundling and post processing. Please check the global preprocessor document for more detail.
-
Jawr has introduced a new feature to overcome in debug mode the IE limitation, which can only handle 30 stylesheets in one page.
This is particularly usefull for user which have CSS bundles in one page, containing more than 30 stylesheets. The new property jawr.debug.ie.force.css.bundle has been added for this purpose. If you set this value to true, in debug mode with an IE browser, Jawr will reference each CSS bundle as a unique CSS resource, instead of referencing all the resources of the bundle. Please check descriptor syntax doc for more detail. - The property jawr.css.image.classpath.use.servlet has been renamed to jawr.css.classpath.handle.image. So the use of jawr.css.image.classpath.use.servlet in your configuration file is deprecated. Use the property jawr.css.classpath.handle.image instead. Please check descriptor syntax doc for more detail.
Fixed issues:
- Issue #98 fixed: Input image tag produces <input type="image" disabled="false"> which disables the button.
- Issue #105 fixed: css @charset declarations must be filtered out for CSS bundle.
- Issue #107 fixed: NullPointerException when using JAWR in JSR-168 context.
- Issue #108 fixed: No check for duplicate rendering of bundles using an alternate production URL.
- Issue #109 fixed: Unnecessary bundling process for bundle using alternate production URL.
- Issue #110 fixed: Image content length is set after the response has been sent.
- Issue #111 fixed: Able to view files under web-inf directory.
- Issue #112 fixed:jawr.config.reload.interval, jawr.config.reload.refreshKey don't work for Jawr with Spring MVC. Thanks to rodneyphillips, axelfont, tkaefer and chupa for reporting issues.
This version contains only bug fixes.
Fixed issues:
- Issue #93 fixed: Localized messages generation only generates default locale when using message generator parameters.
- Issue #95 fixed: CSS classpath generated resources contain postprocessors data in debug mode. Thanks to jmundt for reporting localized messages issue.
Jawr ant task and maven plugin - Version 1.1.2 released:
This version contains only one bug fix.
Fixed issue:
- Issue #96 fixed: Remove entity resolution when using bundle preprocessor. Thanks to acklenx for reporting the issue.
This version contains only bug fixes.
Fixed issues:
- Issue #76 fixed: A Page should render resource bundle only once.
- Issue #89 fixed: Multiple invocations of a custom generator.
- Issue #90 fixed: RendererRequestUtils.setRequestDebuggable(...) creates http sessions.
- Issue #91 fixed: Src of img tag does not support relative path and is incorrect when the requested page is not in the web application root directory.
- Issue #92 fixed: Jawr trips over Javascript multiline string literals We would like to thank qxo, jmundt, reardonm, cpo, kape and axelfont for reporting issues and providing patches when possible.
This version contains mainly bug fixes.
New features/ fixed issues:
- A new tag have been added to the tag library to generate the URL to an image which is handled by Jawr. Look for the image tags at the tag library doc for extra info.
- Issue #74 fixed: NoSuchElementException when bundle has no file. The issue occured when a bundle was defined with no mapping.
- Issue #75 fixed: NullPointerException when using JawrImgServlet and image does not exist.
- Issue #79 fixed: NullPointerException while requesting a CSS in debug mode if no Jawr image servlet was defined.
- Issue #88 fixed: Incorrect logging of "The jawr bundle mapping 'jawr-img-mapping.properties' is not found" We would like to thank sfrancois99, qxo and nordicdevil for reporting issues and providing patches when possible.
New features/ fixed issues:
-
Jawr is now able to handle images. This means that all images managed by Jawr will be cached in the browser as the other Javascript and CSS resources.
By default all CSS images will be handled by Jawr if the Jawr image servlet is defined.
Look for the Jawr image handling section in the servlet docs and at jawr.image.resources in the descriptor syntax docs for extra info.
Two new tags have been added to the tag library to handle these images. Look for the image tags at the tag library doc for extra info. - Jawr supports now JMX, which means that you will be able to modify at runtime the behaviour of Jawr using a JMX console. For example, you will be able to pass from production mode to debug mode an entire application or only one session at runtime. Look at the JMX support doc for extra info.
-
A new "bundle preprocessing" feature has been added in Jawr. This feature is also known as "build time bundle processing".
This feature allows the user to skip the bundling process at server start-up, and use instead the data of preprocessed bundles.
Look at the bundle preprocessing documentation for extra info.
This feature is a new one, it can certainly be improved. So please don't hesitate to give your feedback on the Discussion Forum, on this feature and on Jawr in general. -
We have also created a maven plugin and an Ant task to integrate the new bundle preprocessing feature in the project build phase.
Look at the Jawr Ant task docs and the Jawr maven plugin docs for extra info.
Thanks to Andreas Andreou for the original idea of the maven plugin. -
We have also decided to provide a better support to usage of CDN in Jawr.
The new property jawr.url.contextpath.ssl.override allows you to define what the CDN URL to use for HTTPS requests is.
In debug mode, it is now possible to reference the debug resource files deployed on the CDN. To enable this feature, you will have to set to true, the property jawr.url.contextpath.override.used.in.debug.mode.
Look for these properties in the descriptor syntax docs for extra info. - The property jawr.css.imagepath.override which defined the override path for CSS images has been removed. Now for CSS images, Jawr generates URLs which are relative to the CSS bundle even if the resource is deployed on a CDN. Look at the jawr.css.imagepath.override section at the bundle preprocessing doc for extra info.
- For a better support of CDN, Jawr provides resources which can be integrated more easily in CDN. These files are generated using the bundle preprocessing feature. It even provides a rewrite configuration file for Apache server. Look at the CDN support section at the bundle preprocessing doc for extra info.
- Jawr is now able to discover automatically the locales available for message resources. So the use of the bundle property jawr.js.bundle.[name].locales is no more necessary. Look for jawr.js.bundle.[name].locales at descriptor syntax doc for extra info.
- Issue #69 fixed: CSS from jar file fails when using jawr.debug.overrideKey in production, is now fixed.
- Issue #66 fixed: Add support for @import keyword in CSS is now fixed. You can use the new cssimport post processor to resolve the CSS import. Please take a look at the section CSS Import resolver at postprocessors documentation for more info.
- Issue #72 fixed: Avoid skipping repeated members of bundles in debug mode which is fixed now. Before when the same resources was referenced twice in debug mode, the second one was skipped.
- Issue #73 fixed: java.lang.IndexOutOfBoundsException in CSSMinifier is fixed now. The issue occured when the CSS file contains a '$' character in a non commented section.
New features/ fixed issues:
- While until now it has been possible to load CSS from the classpath, images referenced in them would not be resolved. Now the Jawr servlet can be used to serve images from the classpath as well, thus enabling fully the ability to serve styles and related images from jar files. Look for jawr.css.image.classpath.use.servlet at the servlet docs for extra info.
- The classpath resource generator now allows to use the jar: prefix to map css (it used to be jar_css: for css, now the syntax is the same for both js and css files).
- It is possible to request debug debug mode for a page in production mode. The purpose is to be able to have a javascript debugging session in a deployed application. The bundle members will be requested sepparately as if Jawr were in debug mode easing debug operations without having to redeploy. This is done by adding a special request parameter which is defined in configuration. Look for jawr.debug.overrideKey at the debug and production modes documentation for extra info.
- A new way to force a refresh of all bundles has been added. A secret parameter name is defined in configuration using the key jawr.config.reload.refreshKey, and whenever a request that matches the Jawr servlet includes it, the configuration wil be reloaded. Look for jawr.config.reload.refreshKey at the servlet docs for extra info.
- Orphans search and auto bundle generation can now be disabled for convenience using a new configuration parameter named factory.use.orphans.mapper. It is on by default but when set to false orphans will no longer be searched for.
- Bundles can now be defined with an alternate static URL to use in production mode. This is useful for instance to use publicly served libraries (e.g. the YUI framework) while still using locally served files in development mode. Details can be found at at the bundle definition documentation, check out the productionURL param.
- Issue #60 fixed: Per-file custom postprocessor were not being added to the postprocessing chain. Thanks to user ebottard for providing a patch to solve the issue.
- Issue #61 fixed: The URL path rewriting postprocessor for CSS files was corrupting data: scheme image URLs which is now fixed. Thanks to user Tim Kingman for providing a patch to solve the issue.
- Issue #63 fixed: The 'jawr.custom.postprocessors.names' property is no longer required. Instead, Jawr will detect all 'jawr.custom.postprocessors.[name_of_the_postprocessor].class' declarations to define postprocessors.
- Issue #65 fixed: There was a file leak when using the jawr.config.reload.interval parameter because of a non closed FileInputStream. Fixed.
- Issue #67 fixed: It was not possible to use more than one custom postprocessor per chain due to a bug which is now fixed.
New features/ fixed issues:
- EL expressions in tag libraries are now supported on older servlet containers, thanks to a patch submitted by Ibrahim Chaehoi.
- The jawr.*.bundle.names property is now deprecated, also thanks to a patch submitted by Ibrahim Chaehoi. You may remove all jawr.js.bundle.names and jawr.css.bundle.names from your descriptors. You can still use them if you feel more comfortable that way.
- Jawr now supports jawr.url.contextpath.override that begin with: //. This is a protocol relative url structure. It's handy when you are sharing your css and/or js with different domains and protocols. So these // urls will work relative to http and https.
- Added jawr.css.imagepath.override property to allow for css url replacement that supports absolute URLs or really anything you would like prepended to the URL. This is usefull if you are sharing your css across multiple domains and use background images.
- Classloading has been improved to better support the 18n messages generator, which failed to load properties files under certain conditions.
- Fixed issue 49 (with no jawr.csslinks.flavor setting, style tags are ended with 'null')
- Fixed issue 56 (incorrect path management in Spring MVC controller )
New features/ fixed issues:
- Spring MVC support added. Jawr now provides a Spring MVC Controller so it can now be fully configured through Spring's configuration mechanism. See the manual page for details.
- The way LINK tags are rendered can now be configured. Specifically, depending on the content type you choose for your pages, you may need the link tags to be closed differently, or even not closed at all. By default, tags will be closed as usual (i.e. with '/>'). But adding a new parameter to the properties configuration will make this behavior change. Check the taglib documentation and look for 'jawr.csslinks.flavor' for details.
- A new generator has been added. Now CSS resources can be retrieved from the classpath by using the jar_css prefix.
- [Issue #46] The jawr[css|js].bundle.names property is now augmentable when using ConfigPropertiesAugmenter, as it should have from the start.
- [Unregistered Issue] Jawr does not close the outputstream nor the output writers handed by the servlet container, since that's an illegal operation, as was pointed out by user Lance.









