juju.reattore.server.intercept.impl
Class FileInterceptor

java.lang.Object
  |
  +--juju.reattore.server.intercept.impl.FileInterceptor
All Implemented Interfaces:
Interceptor

public class FileInterceptor
extends java.lang.Object
implements Interceptor

Interceptor that serves up files.


Constructor Summary
FileInterceptor()
          Default Bean constructor.
FileInterceptor(java.lang.String baseDir)
          Create a new FileInterceptor using the given directory as the base directory.
 
Method Summary
 void addDirectoryIndex(java.lang.String name)
          Adds a file that the server will try for if a directory is requested.
 void addExtMap(ExtMap map)
          Adds a mapping between extension and mime type.
 boolean process(HttpRequest req, HttpResponse resp)
          Process an incoming HTTP request if possible, filling in the given response as it goes.
 void setBaseDir(java.lang.String baseDir)
          Set the base directory.
 void setDirectoryIndex(java.lang.String name)
          Sets the file that the server will try for if a directory is requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileInterceptor

public FileInterceptor(java.lang.String baseDir)
Create a new FileInterceptor using the given directory as the base directory.

Parameters:
baseDir - Base directory for all requests.

FileInterceptor

public FileInterceptor()
Default Bean constructor.

Method Detail

setBaseDir

public void setBaseDir(java.lang.String baseDir)
Set the base directory.

Parameters:
baseDir - Base directory for all requests.

addDirectoryIndex

public void addDirectoryIndex(java.lang.String name)
Adds a file that the server will try for if a directory is requested.

Parameters:
name - The path to try.

addExtMap

public void addExtMap(ExtMap map)
Adds a mapping between extension and mime type.

Parameters:
map - The mapping to add/replace.

setDirectoryIndex

public void setDirectoryIndex(java.lang.String name)
Sets the file that the server will try for if a directory is requested. Clears the list set by #addDirectoryIndex.

Parameters:
name - The path to try.

process

public boolean process(HttpRequest req,
                       HttpResponse resp)
Description copied from interface: Interceptor
Process an incoming HTTP request if possible, filling in the given response as it goes. An interceptor may have side effects without actually performing the main processing and may pass it on to another interceptor. A authentication interceptor is a good example.

Specified by:
process in interface Interceptor
Parameters:
req - HTTP request to process
resp - Response to fill in
Returns:
true if the request was recognised and processed.
See Also:
Interceptor


Copyright © 2002-2003 Michael Hope. All Rights Reserved.