The end goal of these utilities is to reduce the number of distinct resource URLs the browser has to retrieve content from for any given page and to take advantage of browser side caching to reduce the number of requests the browser has to make.
Using the Resource Server
The resource server is made of of four main components.
Resource Server Web Application
The web application deployed with uPortal since the 3.1 release which provides:
- Setting aggressive browser-side caching headers for static resources.
- Providing server-side gzip compression of static resources.
- Providing a single URL for a resource that may be used by multiple web applications.
- Fall back gracefully to local static resources if the Resource Server is not available.
- Provide functionality general enough to be interesting to any Java servlet or portlet application.
Resource Server Maven Plugin
Resource Server Utilities
Utility library used by various components for common functionality
- Provide a utility class which does:
- Load lists of both aggregated and un-aggregated CSS/JS files for a web application from the resources XML file.
- Determine if resource aggregation is enabled or disabled based on a system property.
- Determine if the Resource Server Web Application is deployed and if it is if the requested resource is available from it.
- Provide aggregation aware JSP tags to
- Write out the CSS/JS link and script tags from the list of resources loaded by the utility class.
- Generate a resource URL based on if it is available from the Resource Server Web Application.
- Provide aggregation aware servlet filters to
- GZip and cache in memory static resources
- Set long-term browser-side caching headers for static resources based on the path of the resource
Resource Server Content
WAR packaged artifact that contains all of the static content available from the Resource Server Web Application. Used with Maven WAR Overlay support to include the resources used by the web application locally so that fall-back works correctly if the Resource Server Web Application is not available.