Package org.springframework.web.context.support

# Class ServletContextResourceLoader

java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.web.context.support.ServletContextResourceLoader

All Implemented Interfaces:
  `org.springframework.core.io.ResourceLoader`

public class ServletContextResourceLoader extends org.springframework.core.io.DefaultResourceLoader
ResourceLoader implementation that resolves paths as ServletContext resources, for use outside a WebApplicationContext (for example, in an HttpServletBean or GenericFilterBean subclass).

Within a WebApplicationContext, resource paths are automatically resolved as ServletContext resources by the context implementation.

Since:
  1.0.2
Author:
  Juergen Hoeller
See Also:
  - `getResourceByPath(java.lang.String)`
  - `ServletContextResource`
  - `WebApplicationContext`
  - `org.springframework.web.servlet.HttpServletBean`
  - `GenericFilterBean`

## Nested Class Summary

## Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader

`org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource`

## Field Summary

### Fields inherited from interface org.springframework.core.io.ResourceLoader

`CLASSPATH_URL_PREFIX`

## Constructor Summary

Constructors
Constructor
Description
`ServletContextResourceLoader(ServletContext servletContext)`
Create a new ServletContextResourceLoader.

## Method Summary

Modifier and Type
Method
Description
`protected org.springframework.core.io.Resource`
`getResourceByPath(String path)`
This implementation supports file paths beneath the root of the web application.

### Methods inherited from class org.springframework.core.io.DefaultResourceLoader

`addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoader`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ServletContextResourceLoader

public ServletContextResourceLoader(ServletContext servletContext)
Create a new ServletContextResourceLoader.

Parameters:
  `servletContext` - the ServletContext to load resources with

## Method Details

### getResourceByPath

protected org.springframework.core.io.Resource getResourceByPath(String path)
This implementation supports file paths beneath the root of the web application.

Overrides:
  `getResourceByPath` in class `org.springframework.core.io.DefaultResourceLoader`
See Also:
  - `ServletContextResource`