| java.lang.Object simple.http.serve.Component simple.http.serve.IndexedComponent simple.http.serve.DirectoryComponent
DirectoryComponent | final class DirectoryComponent extends IndexedComponent (Code) | | This is used to display the contents of a directory when that
directory is referenced. This will generate a HTML response
that will reference every file in that directory using the
File.list method. This creates the HTML contents
of the directory referenced
This must be given a URI style path, that is a path in the
form of a URI path, UNIX style, for example /a/b. This allows
the Component more flexibility across platforms.
The path given MUST be relative to the current directory. So
if the path is ./path/ then the path given must be /path/.
Backward references are not permitted so a path like ../
is illegal.
author: Niall Gallagher |
Method Summary | |
protected void | process(Request req, Response resp) This will generate the HTML listing of the contents of the
referenced directory. |
DirectoryComponent | public DirectoryComponent(Context context, String target)(Code) | | Constructs a HTML Component to represent the path
specified. The handle method will generate a HTML
listing of all the files in the directory with hyperlinks to
them.
Parameters: target - this is the HTTP request URI for this resource Parameters: context - the root context of this directory resource |
process | protected void process(Request req, Response resp) throws Exception(Code) | | This will generate the HTML listing of the contents of the
referenced directory. Because this listing may be for a
directory that is some directories in depth there may be a
need to give paths relative to the current path. For example
if the URI path "/pub/bin" were the directory "/pub/bin/"
then if the relative URL "README.txt" was clicked on the
page "/pub/bin" the browser would think that it would have
to look for that using the path "/usr/README.txt" because
the browser thinks that "/pub/bin" is not a directory but
rather a resource in "/pub". For a browser to realize that
the URL path it is looking at is a directory and thus look
for relative URLs in it, it needs a "/" ending for this.
If the method used is HEAD then this will write only the
headers and will subsequently close the pipeline. However
this will not handle POST, OPTIONS, TRACE, DELETE or PUT
requests and will generate a "501 Not Implemented" message
if attempted, see RFC 2616 sec 5.1.1.
Parameters: req - the Request to be processed Parameters: resp - the Response to be processed exception: Exception - this is thrown if an uncaptured Exception propagates |
Methods inherited from simple.http.serve.Component | public void handle(Request req, Response resp)(Code)(Java Doc) public void handle(Request req, Response resp, int code)(Code)(Java Doc) public void handle(Request req, Response resp, Report report)(Code)(Java Doc) protected void process(Request req, Response resp, int code) throws Exception(Code)(Java Doc) protected void process(Request req, Response resp, Report report) throws Exception(Code)(Java Doc) abstract protected void process(Request req, Response resp) throws Exception(Code)(Java Doc)
|
|
|