|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.util.net.http.AbstractResponseFactory com.faunos.util.net.http.file.FileResponseFactory
public class FileResponseFactory
A ResponseFactory for serving ordinary files.
Field Summary | |
---|---|
protected static MimeMap |
DEFAULT_MIME_MAP
Default mime map used to set Content-Type HTTP header. |
protected FileFilter |
filter
|
protected MimeMap |
mimeMap
Used to set the "Content-Type" HTTP header. |
static DirectoryFileDefaulter |
NOOP_DEFAULTER
A no-op directory-file defaulter. |
protected File |
root
|
protected String |
uriMountPoint
|
Constructor Summary | |
---|---|
protected |
FileResponseFactory(String uriMountPoint,
File root,
MimeMap mimeMap,
FileFilter filter,
ResponseFactoryConfig config)
|
Method Summary | |
---|---|
void |
close()
Removes this instance from its associated configuration. |
static FileResponseFactory |
getInstance(ResponseFactoryConfig config,
String uriMountPoint)
Returns the instance configured at the specified uriMountPoint, if any. |
static FileResponseFactory |
newInstance(ResponseFactoryConfig config,
String uriMountPoint,
File root)
Creates a new instance configured at the specified URI mount point, with the given root directory. |
static FileResponseFactory |
newInstance(ResponseFactoryConfig config,
String uriMountPoint,
File root,
MimeMap mimeMap,
FileFilter filter)
Creates a new instance configured at the specified URI mount point, with the given root directory. |
protected Stagelet |
prepareDirectoryResponse(RequestHeader request,
StageletStack stack,
File dir)
Returns the response when the request resolves to a file system directory. |
protected Stagelet |
prepareResponseImpl(RequestHeader request,
StageletStack stack)
Returns the factory-specific (i.e. |
void |
setDirectroyFileDefaulter(DirectoryFileDefaulter def)
Sets the file defaulter, for directory response resolution. |
Methods inherited from class com.faunos.util.net.http.AbstractResponseFactory |
---|
badRequest, getResponse, notFound, urlDecode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final MimeMap DEFAULT_MIME_MAP
ExtensionMimeMap
public static final DirectoryFileDefaulter NOOP_DEFAULTER
protected final String uriMountPoint
protected final File root
protected final FileFilter filter
protected final MimeMap mimeMap
Constructor Detail |
---|
protected FileResponseFactory(String uriMountPoint, File root, MimeMap mimeMap, FileFilter filter, ResponseFactoryConfig config)
Method Detail |
---|
public static FileResponseFactory getInstance(ResponseFactoryConfig config, String uriMountPoint)
config
- the configuration object, e.g. one exposed by the container
(Caroon
).uriMountPoint
- the URI mount point. This is the root of HTTP URIs that the
factory responds to.close()
,
newInstance(ResponseFactoryConfig, String, File)
,
newInstance(ResponseFactoryConfig, String, File, MimeMap, FileFilter)
public static FileResponseFactory newInstance(ResponseFactoryConfig config, String uriMountPoint, File root)
config
- the configuration object, e.g. one exposed by the container
(Caroon
).uriMountPoint
- the URI mount point. This is the root of HTTP URIs that this
factory will respond to. It must begin and end in a forward
slash ('/')/root
- the root directory that uriMountPoint will resolve togetInstance(ResponseFactoryConfig, String)
,
close()
public static FileResponseFactory newInstance(ResponseFactoryConfig config, String uriMountPoint, File root, MimeMap mimeMap, FileFilter filter)
config
- the configuration object, e.g. one exposed by the container
(Caroon
).uriMountPoint
- the URI mount point. This is the root of HTTP URIs that this
factory will respond to. It must begin and end in a forward
slash ('/')/root
- the root directory that uriMountPoint will resolve tomimeMap
- the mapping instance used to determine what the HTTP Content-Type
header will be set tofilter
- an option file filter. May be nullgetInstance(ResponseFactoryConfig, String)
,
close()
public void setDirectroyFileDefaulter(DirectoryFileDefaulter def)
public void close()
close
in interface Closeable
ResponseFactoryConfig.removeMapping(String)
protected Stagelet prepareResponseImpl(RequestHeader request, StageletStack stack)
AbstractResponseFactory
prepareResponseImpl
in class AbstractResponseFactory
protected Stagelet prepareDirectoryResponse(RequestHeader request, StageletStack stack, File dir) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |