| java.lang.Object org.jasig.portal.utils.ResourceLoader
ResourceLoader | public class ResourceLoader (Code) | | 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.
author: Ken Weiner, kweiner@unicon.net version: $Revision: 42275 $ since: uPortal 2.0 |
Method Summary | |
public static Document | getResourceAsDocument(Class requestingClass, String resource, boolean validate) Get the contents of a URL as an XML Document
Parameters: requestingClass - the java.lang.Class object of the class that is attempting to load the resource Parameters: resource - a String describing the full or partial URL of the resource whose contents to load Parameters: validate - boolean. | public 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. | public static File | getResourceAsFile(Class requestingClass, String resource) Returns the requested resource as a File. | public static String | getResourceAsFileString(Class requestingClass, String resource) Returns the requested resource as a File string. | public static Properties | getResourceAsProperties(Class requestingClass, String resource) | public static InputSource | getResourceAsSAXInputSource(Class requestingClass, String resource) Returns the requested resource as a SAX input source. | public static InputStream | getResourceAsStream(Class requestingClass, String resource) Returns the requested resource as a stream. | public static String | getResourceAsString(Class requestingClass, String resource) | public static URL | getResourceAsURL(Class requestingClass, String resource) Finds a resource with a given name. | public static String | getResourceAsURLString(Class requestingClass, String resource) Returns the requested resource as a URL string. |
getResourceAsFile | public static File getResourceAsFile(Class requestingClass, String resource) throws ResourceMissingException(Code) | | Returns the requested resource as a File.
Parameters: requestingClass - the java.lang.Class object of the class that is attempting to load the resource Parameters: resource - a String describing the full or partial URL of the resource to load the requested resource as a File throws: org.jasig.portal.ResourceMissingException - |
getResourceAsFileString | public static String getResourceAsFileString(Class requestingClass, String resource) throws ResourceMissingException(Code) | | Returns the requested resource as a File string.
Parameters: requestingClass - the java.lang.Class object of the class that is attempting to load the resource Parameters: resource - a String describing the full or partial URL of the resource to load the requested resource as a File string throws: org.jasig.portal.ResourceMissingException - |
getResourceAsURL | public static URL getResourceAsURL(Class requestingClass, String resource) throws ResourceMissingException(Code) | | Finds a resource with a given name. This is a convenience method for accessing a resource
from a channel or from the uPortal framework. If a well-formed URL is passed in,
this method will use that URL unchanged to find the resource.
If the URL is not well-formed, this method will look for
the desired resource relative to the classpath.
If the resource name starts with "/", it is unchanged. Otherwise, the package name
of the requesting class is prepended to the resource name.
Parameters: requestingClass - the java.lang.Class object of the class that is attempting to load the resource Parameters: resource - a String describing the full or partial URL of the resource to load a URL identifying the requested resource throws: org.jasig.portal.ResourceMissingException - |
getResourceAsURLString | public static String getResourceAsURLString(Class requestingClass, String resource) throws ResourceMissingException(Code) | | Returns the requested resource as a URL string.
Parameters: requestingClass - the java.lang.Class object of the class that is attempting to load the resource Parameters: resource - a String describing the full or partial URL of the resource to load the requested resource as a URL string throws: org.jasig.portal.ResourceMissingException - |
|
|