站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

ResourcePatternResolver (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.core.io.support
Interface ResourcePatternResolver

All Superinterfaces:
ResourceLoader
All Known Subinterfaces:
ApplicationContext, ConfigurableApplicationContext, ConfigurableWebApplicationContext, WebApplicationContext
All Known Implementing Classes:
AbstractApplicationContext, AbstractRefreshableApplicationContext, AbstractRefreshableWebApplicationContext, AbstractXmlApplicationContext, ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, GenericApplicationContext, GenericWebApplicationContext, PathMatchingResourcePatternResolver, ServletContextResourcePatternResolver, StaticApplicationContext, StaticWebApplicationContext, XmlWebApplicationContext

public interface ResourcePatternResolver
extends ResourceLoader

Strategy interface for resolving a location pattern (for example, an Ant-style path pattern) into Resource objects.

This is an extension to the base ResourceLoader interface. A passed-in ResourceLoader (for example, an ApplicationContext passed in via ResourceLoaderAware when running in a context) can be checked whether it implements this extended interface too.

Can be used with any sort of location pattern (e.g. "/WEB-INF/*-context.xml"): Input patterns have to match the strategy implementation. This interface just specifies the conversion method rather than a specific pattern format.

This interface also suggests a new resource prefix "classpath*" for all matching resources from the class path. Note that the resource location is expected to be a path without placeholders in this case (e.g. "/beans.xml"); JAR files or classes directories can contain multiple files of the same name.

Since:
1.0.2
Author:
Juergen Hoeller
See Also:
CLASSPATH_ALL_URL_PREFIX, PathMatchingResourcePatternResolver, Resource, ApplicationContext, ResourceLoaderAware

Field Summary
static String CLASSPATH_ALL_URL_PREFIX
          Pseudo URL prefix for all matching resources from the class path: "classpath*:" This differs from ResourceLoader's classpath URL prefix in that it retrieves all matching resources for a given name (e.g.
static String CLASSPATH_URL_PREFIX
          Deprecated. as of Spring 1.2.2, in favor of CLASSPATH_ALL_URL_PREFIX (to avoid shadowing the constant of the same name in ResourceLoader)
 
Method Summary
 Resource[] getResources(String locationPattern)
          Resolve the given location pattern into Resource objects.
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getResource
 

Field Detail

CLASSPATH_URL_PREFIX

static final String CLASSPATH_URL_PREFIX
Deprecated. as of Spring 1.2.2, in favor of CLASSPATH_ALL_URL_PREFIX (to avoid shadowing the constant of the same name in ResourceLoader)
See Also:
CLASSPATH_ALL_URL_PREFIX, Constant Field Values

CLASSPATH_ALL_URL_PREFIX

static final String CLASSPATH_ALL_URL_PREFIX
Pseudo URL prefix for all matching resources from the class path: "classpath*:" This differs from ResourceLoader's classpath URL prefix in that it retrieves all matching resources for a given name (e.g. "/beans.xml"), for example in the root of all deployed JAR files.

See Also:
ResourceLoader.CLASSPATH_URL_PREFIX, Constant Field Values
Method Detail

getResources

Resource[] getResources(String locationPattern)
                        throws IOException
Resolve the given location pattern into Resource objects.

Overlapping resource entries that point to the same physical resource should be avoided, as far as possible. The result should have set semantics.

Parameters:
locationPattern - the location pattern to resolve
Returns:
the corresponding Resource objects
Throws:
IOException - in case of I/O errors


Copyright (c) 2002-2007 The Spring Framework Project.