Preface
This document contains prerequisite configuration for web applications (including portlets) to use the Resource Server.
Dependencies
If your web application is a maven project, simply add the following dependency to your pom:
<dependency> <groupId>org.jasig.resourceserver</groupId> <artifactId>resource-server-utils</artifactId> <version>1.0.9</version> </dependency>
If your web application is not a maven project, you will need to include the resource-server-utils jar in your application's classpath (for example, in WEB-INF/lib).
Configuration
The Context for your web application will need to have "cross context dispatching" enabled.
This is enabled for an application deployed in tomcat by creating a META-INF directory including a file named "context.xml" with simply the following contents:
<Context crossContext="true"/>
If your web application is a maven project, this directory will need to be created using the path 'src/main/webapp/META-INF'.
Example
Declaring the resource server taglib in a JSP:
<%@ taglib prefix="rs" uri="http://www.jasig.org/resource-server" %>
Embedding a resource in your content:
<rs:resourceURL var="starIcon" value="/rs/famfamfam/silk/1.3/star.png"/> <img src="${starIcon}" alt="A Star" title="A Star"/>