public class ResourceLoader extends Object
Modifier | Constructor and Description |
---|---|
protected |
ResourceLoader()
Constructs a new root resource loader.
|
protected |
ResourceLoader(ResourceLoader parent)
Constructs a new resource loader with specified parent resource loader.
|
Modifier and Type | Method and Description |
---|---|
protected URL |
findResource(String name)
Finds the resource with the given name.
|
static String |
getContentType(ResourceLoader loader,
URLConnection conn)
Called by the
ResourceServlet to get the content type for
the given connection. |
protected String |
getContentType(URLConnection conn)
Returns the content type of this URL connection.
|
static ResourceLoader |
getNullResourceLoader()
Returns the shared resource loader that always returns null.
|
protected ResourceLoader |
getParent()
Returns the parent resource loader, or null if this is a root
resource loader.
|
URL |
getResource(String name)
Finds the resource with the given name.
|
boolean |
isCachable()
Returns whether a resource is cachable.
|
String |
toString() |
protected ResourceLoader(ResourceLoader parent)
parent
- the parent resource loaderprotected ResourceLoader()
public static ResourceLoader getNullResourceLoader()
public URL getResource(String name) throws IOException
The name of a resource is a '/'-separated path name that identifies the resource.
This method will first search the this resource loader for the
resource. That failing, this method will invoke
findResource(String)
to on the parent resource loader to
find the resource.
name
- the resource nameIOException
public boolean isCachable()
protected URL findResource(String name) throws IOException
name
- The resource nameIOException
public static String getContentType(ResourceLoader loader, URLConnection conn)
ResourceServlet
to get the content type for
the given connection.loader
- the loader that provided the URL for the URL connectionconn
- the URL connectionprotected String getContentType(URLConnection conn)
protected ResourceLoader getParent()
Copyright © 2001-2016 The Apache Software Foundation. All Rights Reserved.