|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimple.http.serve.FileEngine
public class FileEngine
The FileEngine
is used to produce implementations
of the Resource
object to represent files on the
underlying filesystem. This will produce Resource
objects that map on to the suggested URI relative to some
given Context
. The Context
must be
given as a root so all requests for Resource
's are
retrieved relative to that root.
The meaning of HTTP URI in this instance is the request URI from a HTTP/x.x request, as RFC 2616 and RFC 2396 defines it
Request-Line = Method SP Request-URI SP HTTP-Version CRLF Request-URI = "*" | absoluteURI | abs_path | authority absoluteURI = "http:" "//" host [":" port] [abs_path ["?" query]] abs_path = "/" path_segments path_segments = segment *( "/" segment )So the
FileEngine
object will accept the request URI
that come in the form outlined above. These can include formats
like
http://some.host/pub;param=value/bin/index.html?name=value http://some.host:8080/index.en_US.html some.host:8080/index.html /usr/bin;param=value/README.txt /usr/bin/compress.tar.gzThe
FileEngine
object will directly take a request
URI as defined in RFC 2616 and translate this into a system
specific Resource
. This keeps the objects semantics
simple and explicit, although at the expense of performance.
CacheContext
Field Summary | |
---|---|
protected Context |
context
Each FileEngine operates using a context. |
Constructor Summary | |
---|---|
FileEngine()
Constructor for the FileEngine . |
|
FileEngine(Context context)
Constructor takes a Context implementation and
operates relative to that implementation. |
Method Summary | |
---|---|
Resource |
resolve(java.lang.String target)
This will look for and retrieve the requested resource. |
protected Resource |
resolve(java.lang.String target,
java.io.File file)
This will look for and retrieve the requested resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Context context
FileEngine
operates using a context.
Constructor Detail |
---|
public FileEngine()
FileEngine
. This uses the
current working directory to serve the Resource
.
This will retrieve and represent OS specific resources such
as files using Resource
implementations. This
also keeps a cache of the file contents requested.
public FileEngine(Context context)
Context
implementation and
operates relative to that implementation. This will retrieve
and represent OS specific resources such as files using
Resource
implementations. This relies on the
provided context to perform caching for this implementation.
context
- this is the context the file engine will useMethod Detail |
---|
public Resource resolve(java.lang.String target)
Resource
implementation that will handle the target.
resolve
in interface ResourceEngine
target
- the URI style path that represents the target
protected Resource resolve(java.lang.String target, java.io.File file)
Resource
implementation that will handle the target.
target
- the URI style path that represents the targetfile
- this is the file that represents the resource
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |