public class DefaultResourceLoader extends java.lang.Object implements ResourceLoader
Title: DefaultResourceLoader.java
Description:
bboss workgroup
Copyright (c) 2007
CLASSPATH_URL_PREFIX| Constructor and Description |
|---|
DefaultResourceLoader()
Create a new DefaultResourceLoader.
|
DefaultResourceLoader(java.lang.ClassLoader classLoader)
Create a new DefaultResourceLoader.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.ClassLoader |
getClassLoader()
Return the ClassLoader to load class path resources with,
or
null if using the thread context class loader on actual access
(applying to the thread that constructs the ClassPathResource object). |
Resource |
getResource(java.lang.String location)
Return a Resource handle for the specified resource.
|
protected Resource |
getResourceByPath(java.lang.String path)
Return a Resource handle for the resource at the given path.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Specify the ClassLoader to load class path resources with, or
null
for using the thread context class loader at the time of actual resource access. |
public DefaultResourceLoader()
ClassLoader access will happen using the thread context class loader at the time of this ResourceLoader's initialization.
Thread.getContextClassLoader()public DefaultResourceLoader(java.lang.ClassLoader classLoader)
classLoader - the ClassLoader to load class path resources with, or null
for using the thread context class loader at the time of actual resource accesspublic void setClassLoader(java.lang.ClassLoader classLoader)
null
for using the thread context class loader at the time of actual resource access.
The default is that ClassLoader access will happen using the thread context class loader at the time of this ResourceLoader's initialization.
public java.lang.ClassLoader getClassLoader()
null if using the thread context class loader on actual access
(applying to the thread that constructs the ClassPathResource object).
Will get passed to ClassPathResource's constructor for all ClassPathResource objects created by this resource loader.
getClassLoader in interface ResourceLoadernull)ClassPathResourcepublic Resource getResource(java.lang.String location)
ResourceLoaderInputStreamSource.getInputStream() calls.
Note that a Resource handle does not imply an existing resource;
you need to invoke Resource.exists() to check for existence.
getResource in interface ResourceLoaderlocation - the resource locationResourceLoader.CLASSPATH_URL_PREFIX,
Resource.exists(),
InputStreamSource.getInputStream()protected Resource getResourceByPath(java.lang.String path)
The default implementation supports class path locations. This should be appropriate for standalone implementations but can be overridden, e.g. for implementations targeted at a Servlet container.
path - the path to the resourceClassPathResource