|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.grails.io.support.DefaultResourceLoader
public class DefaultResourceLoader
Default implementation of the ResourceLoader interface.
Will return a UrlResource if the location value is a URL, and a ClassPathResource if it is a non-URL path or a "classpath:" pseudo-URL.
| Field Summary |
|---|
| Fields inherited from interface org.codehaus.groovy.grails.io.support.ResourceLoader |
|---|
CLASSPATH_URL_PREFIX |
| Constructor Summary | |
|---|---|
DefaultResourceLoader()
Create a new DefaultResourceLoader. |
|
DefaultResourceLoader(java.lang.ClassLoader classLoader)
Create a new DefaultResourceLoader. |
|
| Method Summary | |
|---|---|
java.lang.ClassLoader |
getClassLoader()
Return the ClassLoader to load class path resources with. |
static java.lang.ClassLoader |
getDefaultClassLoader()
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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 access| Method Detail |
|---|
public static java.lang.ClassLoader getDefaultClassLoader()
public 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()
getClassLoader in interface ResourceLoadernull)public Resource getResource(java.lang.String location)
ResourceLoaderNote 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 location
ResourceLoader.CLASSPATH_URL_PREFIXprotected 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 resource
ClassPathResource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||