|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.ibm.wbi.Meg
|
+--com.ibm.wbi.Generator
|
+--com.ibm.wbi.protocol.http.HttpGenerator
|
+--com.ibm.wbi.protocol.http.beans.MultipleFileGenerator
This Generator serves any of the requested files from a directory, or one of its subdirectories. It has three properties: Directory, UrlPrefix, and ContentType. The Directory property specifies the root directory of the local filesystem in which the served files can be found. UrlPrefix specifies a path prefix that will be expected to be part of the requested URL that should be ignored. For example, if the Directory is "c:\datafiles" and the UrlPrefix is "home/data" and the requested URL is: "http://myserver/home/data/foo/a.html" then the Generator will serve the file "c:\datafiles\foo\a.html". The ContentType property is used to specify the content type that will be reported for served files.
The DefaultFile property is used to redirect a browser to a default file within a directory if the specified filename is itself a directory. If DefaultFile is null, a null string, or points to a non-existent file, this property is ignored.
The ShowDirectories property determines whether references to directories will by rendered as a page of links to the files within the directory or not. This property defaults to false.
Note: this Generator will serve files from the Directory directory and any of its children, but prevents access to files with ".." in their path. If a requested file does not exist, a RequestRejectedException is thrown.
A limitation of this Generator is that all files served will have the same content type. This could be solved with a smarter Generator, or by adding an Editor which fixes the content type.
| Fields inherited from class com.ibm.wbi.protocol.http.HttpGenerator |
COPYRIGHT, http |
| Fields inherited from class com.ibm.wbi.Meg |
EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED |
| Constructor Summary | |
MultipleFileGenerator()
the default constructor. |
|
MultipleFileGenerator(java.lang.String d)
construct an instance. |
|
MultipleFileGenerator(java.lang.String d,
java.lang.String type)
construct an instance. |
|
| Method Summary | |
java.lang.String |
getDefaultFile()
Access the DefaultFile property. |
java.lang.String |
getDirectory()
Access the Directory property. |
java.lang.String |
getUrlPrefix()
Access the UrlPrefix property. |
void |
handleRequest(RequestEvent e)
Method used by WBI to generate the document. |
boolean |
isLinkToParentDirectory()
Access the LinkToParentDirectory property. |
boolean |
isShowDirectories()
Access the ShowDirectories property. |
void |
setDefaultFile(java.lang.String df)
Set the DefaultFile property. |
void |
setDirectory(java.lang.String d)
Set the directory property. |
void |
setLinkToParentDirectory(boolean ltpd)
Set the LinkToParentDirectory property. |
void |
setShowDirectories(boolean sd)
Set the ShowDirectories property. |
void |
setUrlPrefix(java.lang.String up)
Set the UrlPrefix property. |
| Methods inherited from class com.ibm.wbi.protocol.http.HttpGenerator |
add, addCookie, getContentType, getHttpResponse, getHttpResponseString, getResponseCode, getResponseText, isCache, produceHeader, set, setCache, setContentLength, setContentType, setResponseCode, setResponseText, setServer, writeHeader |
| Methods inherited from class com.ibm.wbi.Generator |
getType |
| Methods inherited from class com.ibm.wbi.Meg |
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup |
| Constructor Detail |
public MultipleFileGenerator()
public MultipleFileGenerator(java.lang.String d)
d - specifies the Directory in which files can be found
public MultipleFileGenerator(java.lang.String d,
java.lang.String type)
d - specifies the Directory in which files can be foundtype - specifies the ContentType to pass along to the browser| Method Detail |
public void setDefaultFile(java.lang.String df)
public java.lang.String getDefaultFile()
public void setShowDirectories(boolean sd)
sd - If true, directories will be rendered
as an HTML page of links. If false, an error page will be produced.public boolean isShowDirectories()
public void setDirectory(java.lang.String d)
d - String specifying the directory on the local file system in which the files to be served
can be found.public java.lang.String getDirectory()
public void setUrlPrefix(java.lang.String up)
up - the UrlPrefixpublic java.lang.String getUrlPrefix()
public void setLinkToParentDirectory(boolean ltpd)
ltpd - If true, there will be a link to the parent directory (i.e. "..")public boolean isLinkToParentDirectory()
public void handleRequest(RequestEvent e)
throws RequestRejectedException,
java.io.IOException
handleRequest in class HttpGeneratore - Request event object.COM.ibm.iawbi.almaden.megBean.RequestRejectedException - is
thrown if the request contains ".." in its path, or if the requested
file does not exist.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||