Skip to main content
Last updated February 11, 2011 00:38, by icefox
Feedicon  

We are still in the migration process. We need to move all the documentation from the old site to the new one. We will inform you when the migration of the content will be done. The documentation is available as an archive file in the download section : http://java.net/projects/jawr/downloads

Sorry for the inconvenience



Jawr

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.

Announcement


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.

Fixed issues:

  • 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.

Fixed issues:

  • 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.

Fixed issue:

  • 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.

Fixed issues:

  • 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

You can retrieve them from the SVN repository : http://jawr.java.net/svn/jawr/trunk jawr/samples/

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.

 
 
Close
loading
Please Confirm
Close