ResourceLoader implementation that interprets plain resource paths
as relative to a given java.lang.Class.
Class#getResource(String), ClassPathResource#ClassPathResource(String, Class)
| Modifier and Type | Class and Description |
|---|---|
| private static class | ClassRelativeResourceLoader.
ClassPathResource that explicitly expresses a context-relative path through implementing the ContextResource interface. |
| Access | Constructor and Description |
|---|---|
| public | ClassRelativeResourceLoader(Class<?>
the class to load resources through clazz)Create a new ClassRelativeResourceLoader for the given class. |
| Modifier and Type | Method and Description |
|---|---|
| protected Resource | getResourceByPath(String
the path to the resource path)Overrides org. Return a Resource handle for the resource at the given path. |
| clazz | back to summary |
|---|---|
| private final Class<?> clazz | |
| ClassRelativeResourceLoader | back to summary |
|---|---|
| public ClassRelativeResourceLoader(Class<?> clazz) Create a new ClassRelativeResourceLoader for the given class.
| |
| getResourceByPath | back to summary |
|---|---|
| protected Resource getResourceByPath(String path) Overrides org. Doc from org. Return a Resource handle for the resource at the given 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. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Resource | createRelative(String
the relative path (relative to this resource) relativePath)Overrides org. Implements org. Create a resource relative to this resource. |
| public String | getPathWithinContext()
Implements org. Return the path within the enclosing 'context'. |
| clazz | back to summary |
|---|---|
| private final Class<?> clazz | |
| ClassRelativeContextResource | back to summary |
|---|---|
| public ClassRelativeContextResource(String path, Class<?> clazz) | |
| createRelative | back to summary |
|---|---|
| public Resource createRelative(String relativePath) Overrides org. Implements org. Doc from org. Create a resource relative to this resource. | |
| getPathWithinContext | back to summary |
|---|---|
| public String getPathWithinContext() Implements org. Doc from org. Return the path within the enclosing 'context'. This is typically path relative to a context-specific root directory, e.g. a ServletContext root or a PortletContext root.
| |