|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.template.Template
sunlabs.brazil.template.DirectoryTemplate (view source)
public class DirectoryTemplate
Put current directory information (based on the URL) into the
request properties.
The <filelist>
tag, if present in the document,
triggers the generation of a directory and file listing, based on the
current URL.
Template Properties:
"[prefix].root"
, or in
"root"
, or (if neither exists), the current
directory of the server.
FileHandler
for a
description of how to set mime types for url suffixes.
prefix
is used to match the leading
portion of a URL.
The tag takes the optional parameters: prepend
and stats
that override the corrosponding request
properties (above). In addition, the attribute dir
may be used to select an alternate directory for files.
Field Summary |
---|
Fields inherited from class sunlabs.brazil.template.Template |
---|
debug |
Constructor Summary | |
---|---|
DirectoryTemplate()
|
Method Summary | |
---|---|
static void |
getFiles(String dir,
String glob,
Request request,
String prefix)
Generate properties containing the files and directories in the "current" directory. |
boolean |
init(RewriteContext hr)
Reset at each page |
boolean |
init(Server server,
String prefix)
Initializes the handler. |
boolean |
respond(Request request)
Compute the directory info, and add it to the request properties. |
void |
tag_filelist(RewriteContext hr)
Turn on the directory calculator. |
Methods inherited from class sunlabs.brazil.template.Template |
---|
done |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectoryTemplate()
Method Detail |
---|
public boolean init(Server server, String prefix)
Handler
init
in interface Handler
server
- The HTTP server that created this Handler
.
Typical Handler
s will use Server.props
to obtain run-time configuration information.prefix
- The handlers name.
The string this Handler
may prepend to all
of the keys that it uses to extract configuration information
from Server.props
. This is set (by the Server
and ChainHandler
) to help avoid configuration parameter
namespace collisions.
true
if this Handler
initialized
successfully, false
otherwise. If
false
is returned, this Handler
should not be used.public boolean respond(Request request)
respond
in interface Handler
request
- The Request
object that represents the HTTP
request.
true
if the request was handled. A request was
handled if a response was supplied to the client, typically
by calling Request.sendResponse()
or
Request.sendError
.public boolean init(RewriteContext hr)
init
in interface TemplateInterface
init
in class Template
public void tag_filelist(RewriteContext hr)
The attribute "stats" may be specified to enable additional statistics, overriding the request properties.
public static void getFiles(String dir, String glob, Request request, String prefix)
If "directory" is specified (e.g. not null), then it is used as the directory instead. If "directory" starts with "/" then the directory is resolved relative to the document root, otherwise it is resolved relative to the current directory. If "select" is specified, then only files or directories matching the supplied glob pattern are selected. If the first character of "select" is "!", then the sense of the glob pattern is inverted.
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |