Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.util
Class WebApplicationResourceLocator

    java.lang.Object
      org.apache.cayenne.util.ResourceLocator
          org.apache.cayenne.util.WebApplicationResourceLocator

All Implemented Interfaces:
  ResourceFinder

    public class WebApplicationResourceLocator

extends ResourceLocator

A ResourceLocator that can find resources relative to web application context.

Field Summary
`protected List<String>` | `additionalContextPaths`
`protected javax.servlet.ServletContext` | `context`

Fields inherited from class org.apache.cayenne.util.ResourceLocator
`additionalClassPaths, additionalFilesystemPaths, classLoader, skipAbsolutePath, skipClasspath, skipCurrentDirectory, skipHomeDirectory`

Constructor Summary
`WebApplicationResourceLocator()`
`WebApplicationResourceLocator(javax.servlet.ServletContext context)` Creates new WebApplicationResourceLocator with default lookup policy including user home directory, current directory and CLASSPATH.

Method Summary
`void` | `addFilesystemPath(String path)` Override ResourceLocator.addFilesystemPath(String) to intercept context paths starting with "/WEB-INF/" to place in additionalContextPaths.
`URL` | `findResource(String location)` Looks for resources relative to /WEB-INF/ directory or any extra context paths configured.
`javax.servlet.ServletContext` | `getServletContext()` Gets the ServletContext used to locate resources.
`void` | `setServletContext(javax.servlet.ServletContext servletContext)` Sets the ServletContext used to locate resources.

Methods inherited from class org.apache.cayenne.util.ResourceLocator
`addClassPath, addFilesystemPath, classBaseUrl, findDirectoryResource, findFileInCurrentDirectory, findFileInFileSystem, findFileInHomeDirectory, findResourceInClasspath, findResourceInFileSystem, findResourceStream, findURLInClassLoader, findURLInClasspath, getClassLoader, getResource, getResources, setClassLoader, setSkipAbsolutePath, setSkipClasspath, setSkipCurrentDirectory, setSkipHomeDirectory, willSkipAbsolutePath, willSkipClasspath, willSkipCurrentDirectory, willSkipHomeDirectory`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### context

    protected javax.servlet.ServletContext context

### additionalContextPaths

    protected List<String> additionalContextPaths

Constructor Detail

### WebApplicationResourceLocator

    public WebApplicationResourceLocator()

Since:
  1.2

### WebApplicationResourceLocator

    public WebApplicationResourceLocator(javax.servlet.ServletContext context)

  Creates new WebApplicationResourceLocator with default lookup policy including user home directory, current directory and CLASSPATH.

Method Detail

### setServletContext

    public void setServletContext(javax.servlet.ServletContext servletContext)

  Sets the ServletContext used to locate resources.

### getServletContext

    public javax.servlet.ServletContext getServletContext()

  Gets the ServletContext used to locate resources.

### findResource

    public URL findResource(String location)

  Looks for resources relative to /WEB-INF/ directory or any extra context paths configured. Internal ServletContext is used to find resources.

  Overrides:
    `findResource` in class `ResourceLocator`

### addFilesystemPath

    public void addFilesystemPath(String path)

  Override ResourceLocator.addFilesystemPath(String) to intercept context paths starting with "/WEB-INF/" to place in additionalContextPaths.

  Overrides:
    `addFilesystemPath` in class `ResourceLocator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 Apache Cayenne. All Rights Reserved.