org.inria.ns.reflex.modules.io.web
Class WebFileProvider

java.lang.Object
  extended by org.apache.commons.vfs.provider.AbstractVfsComponent
      extended by org.apache.commons.vfs.provider.AbstractVfsContainer
          extended by org.apache.commons.vfs.provider.AbstractFileProvider
              extended by org.inria.ns.reflex.modules.io.web.WebFileProvider
All Implemented Interfaces:
FileProvider, VfsComponent

public class WebFileProvider
extends AbstractFileProvider

A file provider for the web scheme that resolves files according to the context of a Web application.

Usage : web:///path/to/resource

Each servlet that intend to use the web scheme must invoke WebFileSystemConfigBuilder.registerWebapp(ServletContext) for each HTTP request to serve, and in the Servlet.init(javax.servlet.ServletConfig) method.

To be more precise, the scheme is available for the same thread that registers the web application, and its descendents.

Author:
Philippe Poulard

Constructor Summary
WebFileProvider()
          Create a new web provider.
 
Method Summary
 void closeFileSystem(FileSystem filesystem)
          Do nothing.
 FileObject findFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions)
          Locates a file object, by absolute URI.
 Collection getCapabilities()
          Return the capabilities of this file system.
 FileSystemConfigBuilder getConfigBuilder()
          Return an instance of the config builder for this file system.
 
Methods inherited from class org.apache.commons.vfs.provider.AbstractFileProvider
close, createFileSystem, freeUnusedResources, parseUri
 
Methods inherited from class org.apache.commons.vfs.provider.AbstractVfsComponent
init, setContext, setLogger
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebFileProvider

public WebFileProvider()
Create a new web provider.

Method Detail

findFile

public FileObject findFile(FileObject baseFile,
                           String uri,
                           FileSystemOptions fileSystemOptions)
                    throws FileSystemException
Locates a file object, by absolute URI.

Parameters:
baseFile -
uri -
fileSystemOptions -
Returns:
Throws:
FileSystemException

getConfigBuilder

public FileSystemConfigBuilder getConfigBuilder()
Return an instance of the config builder for this file system.

Specified by:
getConfigBuilder in interface FileProvider
Overrides:
getConfigBuilder in class AbstractFileProvider
Returns:
An instance of the config builder for this file system.
See Also:
WebFileSystemConfigBuilder.getInstance()

closeFileSystem

public void closeFileSystem(FileSystem filesystem)
Do nothing.

Overrides:
closeFileSystem in class AbstractFileProvider
Parameters:
filesystem - Not used.

getCapabilities

public Collection getCapabilities()
Return the capabilities of this file system.

Returns:
A collection with the capability : Capability.DISPATCHER.