|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.portal.utils.ResourceLoader
public class ResourceLoader
This utility provides methods for accessing resources. The methods generally use the classpath to find the resource if the requested URL isn't already specified as a fully-qualified URL string.
The methods of this class sort of replace the old UtiltiesBean.fixURI() method.
| Constructor Summary | |
|---|---|
ResourceLoader()
|
|
| Method Summary | |
|---|---|
static Document |
getResourceAsDocument(Class<?> requestingClass,
String resource)
Get the contents of a URL as an XML Document, first trying to read the Document with validation turned on, and falling back to reading it with validation turned off. |
static Document |
getResourceAsDocument(Class<?> requestingClass,
String resource,
boolean validate)
Get the contents of a URL as an XML Document |
static Properties |
getResourceAsProperties(Class<?> requestingClass,
String resource)
Get the contents of a URL as a java.util.Properties object |
static InputSource |
getResourceAsSAXInputSource(Class<?> requestingClass,
String resource)
Returns the requested resource as a SAX input source. |
static InputStream |
getResourceAsStream(Class<?> requestingClass,
String resource)
Returns the requested resource as a stream. |
static String |
getResourceAsString(Class<?> requestingClass,
String resource)
Get the contents of a URL as a String |
static URL |
getResourceAsURL(Class<?> requestingClass,
String resource)
Finds a resource with a given name. |
static String |
getResourceAsURLString(Class<?> requestingClass,
String resource)
Returns the requested resource as a URL string. |
static long |
getResourceLastModified(Class<?> requestingClass,
String resource)
|
Map<Tuple<Class<?>,String>,URL> |
getResourceUrlCache()
|
Map<Tuple<Class<?>,String>,ResourceMissingException> |
getResourceUrlNotFoundCache()
|
void |
setResourceUrlCache(Map<Tuple<Class<?>,String>,URL> resourceUrlCache)
|
void |
setResourceUrlNotFoundCache(Map<Tuple<Class<?>,String>,ResourceMissingException> resourceUrlNotFoundCache)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceLoader()
| Method Detail |
|---|
public Map<Tuple<Class<?>,String>,URL> getResourceUrlCache()
public void setResourceUrlCache(Map<Tuple<Class<?>,String>,URL> resourceUrlCache)
resourceUrlCache - the resourceUrlCache to setpublic Map<Tuple<Class<?>,String>,ResourceMissingException> getResourceUrlNotFoundCache()
public void setResourceUrlNotFoundCache(Map<Tuple<Class<?>,String>,ResourceMissingException> resourceUrlNotFoundCache)
resourceUrlNotFoundCache - the resourceUrlNotFoundCache to set
public static URL getResourceAsURL(Class<?> requestingClass,
String resource)
throws ResourceMissingException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource to load
ResourceMissingException
public static String getResourceAsURLString(Class<?> requestingClass,
String resource)
throws ResourceMissingException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource to load
ResourceMissingException
public static long getResourceLastModified(Class<?> requestingClass,
String resource)
public static InputStream getResourceAsStream(Class<?> requestingClass,
String resource)
throws ResourceMissingException,
IOException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource to load
ResourceMissingException
IOException
public static InputSource getResourceAsSAXInputSource(Class<?> requestingClass,
String resource)
throws ResourceMissingException,
IOException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource to load
ResourceMissingException
IOException
public static Document getResourceAsDocument(Class<?> requestingClass,
String resource,
boolean validate)
throws ResourceMissingException,
IOException,
ParserConfigurationException,
SAXException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource whose contents to loadvalidate - boolean. True if the document builder factory should validate, false otherwise.
ResourceMissingException
IOException
ParserConfigurationException
SAXException
public static Document getResourceAsDocument(Class<?> requestingClass,
String resource)
throws ResourceMissingException,
IOException,
ParserConfigurationException,
SAXException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource whose contents to load
ResourceMissingException
IOException
ParserConfigurationException
SAXException
public static Properties getResourceAsProperties(Class<?> requestingClass,
String resource)
throws ResourceMissingException,
IOException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource whose contents to load
ResourceMissingException
IOException
public static String getResourceAsString(Class<?> requestingClass,
String resource)
throws ResourceMissingException,
IOException
requestingClass - the java.lang.Class object of the class that is attempting to load the resourceresource - a String describing the full or partial URL of the resource whose contents to load
ResourceMissingException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||