Setting Up uPortal 3.1.1 for Front-End Development
uPortal 3.1.1, by default, caches the CSS, JavaScript and XSL resources utilized in developing and managing the portal's front-end to enhance performance. Disabling this behavior in a development environment is vital to any developer working to enhance uPortal's front-end in a timely manner. Disabling uPortal's caching mechanisms allows developers the ability to preview changes without having to restart uPortal's servlet container (e.g., Tomcat). This article provides a quick reference for disabling uPortal's default caching behaviour as it relates to user interface development.
Step 1: Disable uPortal's CSS and JavaScript resource caching.
uPortal's CSS and JavaScript resources are cached by default. This caching is great for performance and load times, but will prevent user interface changes from showing, as a cached version will be displayed instead. Disabling this caching allows for CSS and JavaScript files to be edited and previewed without having to stop and restart the servlet container. This results in more efficient and rapid development, as CSS and JS changes can be seen immediately with a simple browser refresh.
To disable CSS and JavaScript caching:
- Navigate to uPortal's source: uPortal-3.1.1/uportal-war/src/main/webapp/WEB-INF
- Open the file: web.xml
- Near code line 186 (Figure 1), comment out the pageCachingFilter
- For changes to take affect, shutdown your servlet container and run ant deploy-war on the command-line from uPortal's source directory. For this example, we would run ant deploy-war from the /uPortal-3.1.1 directory. When the deploy has completed, startup your servlet container.
/*================ Excerpt from web.xml ===============*/ /*================ Excerpt from web.xml ===============*/ pageCachingFilter *.js *.css
Figure 1.
Step 2: Disable uPortal's XSL stylesheet caching.
The portal's XSL stylesheets are responsible for rendering uPortal's underlying HTML structure. As with CSS and JavaScript, it is also helpful to disable XSL caching so that developers can edit and preview markup changes without having to restart the servlet container.
To disable XSL stylesheet caching:
- Navigate to uPortal's source: uPortal-3.1.1/uportal-impl/src/main/resources/properties/
- Open the file: portal.properties
- Search portal.properties for each of the following properties:
- org.jasig.portal.utils.XSLT.stylesheet_root_caching
- org.jasig.portal.PortalSessionManager.url_caching
- org.jasig.portal.UserInstance.cache_enabled
- Each property should be set to off (Figure 2).
- As with disabling the resource caching, for XSL stylesheet caching changes to take affect, shut down your servlet container (Tomcat) and run ant deploy-war on the command-line from uPortal's source directory. For this example, we would run ant deploy-war from the /uPortal-3.1.1 directory. When the deploy has completed, startup your servlet container.
/*================ Excerpt from portal.properties ===============*/ # Controls whether or not pre-compiled stylesheets should be cached. # Setting this to "on" improves performance, but then changes to # any stylesheet files (.xsl) will not take effect until # the portal has been restarted. org.jasig.portal.utils.XSLT.stylesheet_root_caching=off # Controls whether URL content is cached # When using CAR files, this option, along with the stylesheet root caching controls # the caching of XSL files, since they are loaded from a jar URL org.jasig.portal.PortalSessionManager.url_caching=off # Controls caching for framework stylesheets org.jasig.portal.UserInstance.cache_enabled=off /*================ Excerpt from portal.properties ===============*/
Figure 2.
For additional theme and skin resources, please visit the JA-SIG Wiki at http://www.ja-sig.org/wiki/display/UPC/User+Interface
