Top Description Fields Constructors Methods
org.springframework.web.context.support

public Class ServletContextResourceLoader

extends DefaultResourceLoader
Class Inheritance
Imports
jakarta.servlet.ServletContext, org.springframework.core.io.DefaultResourceLoader, .Resource

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.

Author
Juergen Hoeller
Since
1.0.2
See Also
getResourceByPath, ServletContextResource, org.springframework.web.context.WebApplicationContext, org.springframework.web.servlet.HttpServletBean, org.springframework.web.filter.GenericFilterBean

Field Summary

Modifier and TypeField and Description
private final ServletContext

Constructor Summary

AccessConstructor and Description
public
ServletContextResourceLoader(ServletContext
the ServletContext to load resources with
servletContext
)

Create a new ServletContextResourceLoader.

Method Summary

Modifier and TypeMethod and Description
protected Resource
getResourceByPath(String
the path to the resource
path
)

Overrides org.springframework.core.io.DefaultResourceLoader.getResourceByPath.

This implementation supports file paths beneath the root of the web application.

Inherited from org.springframework.core.io.DefaultResourceLoader:
addProtocolResolverclearResourceCachesgetClassLoadergetProtocolResolversgetResourcegetResourceCachesetClassLoader

Field Detail

servletContextback to summary
private final ServletContext servletContext

Constructor Detail

ServletContextResourceLoaderback to summary
public ServletContextResourceLoader(ServletContext servletContext)

Create a new ServletContextResourceLoader.

Parameters
servletContext:ServletContext

the ServletContext to load resources with

Method Detail

getResourceByPathback to summary
protected Resource getResourceByPath(String path)

Overrides org.springframework.core.io.DefaultResourceLoader.getResourceByPath.

This implementation supports file paths beneath the root of the web application.

Parameters
path:String

Doc from org.springframework.core.io.DefaultResourceLoader.getResourceByPath.

the path to the resource

Returns:Resource

Doc from org.springframework.core.io.DefaultResourceLoader.getResourceByPath.

the corresponding Resource handle

Annotations
@Override
See Also
ServletContextResource