public class FileListElement
extends java.lang.Object
implements java.io.Serializable
This example creates an FileListElement object:
// Create a HTMLTree object. HTMLTree tree = new HTMLTree(req); // Create a URLParser object. URLParser urlParser = new URLParser(httpServletRequest.getRequestURI()); // Create a object to represent the connection to the system. AS400 system = new AS400(mySystem, myUserId, myPassword); // Create an IFS object. IFSJavaFile root = new IFSJavaFile(system, "/QIBM"); // Create a DirFilter object and get the directories. DirFilter filter = new DirFilter(); File[] dirList = root.listFiles(filter); for (int i=0; i < dirList.length; i++) { // Create a FileTreeElement. FileTreeElement element = new FileTreeElement(dirList[i]); // Set the Icon URL. ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); sl.setHttpServletResponse(resp); element.setIconUrl(sl); // Set the text url so it calls another // servlet to display the contents of the FileTreeElement. ServletHyperlink tl = new ServletHyperlink("/servlet/myListServlet"); tl.setTarget("listFrame"); // Set the TextUrl for the FileTreeElement. element.setTextUrl(tl); // Add the FileTreeElement to the tree. tree.addElement(element); } // When the user clicks on text url in the HTMLTree it should call another // servlet to display the contents. It is here that the FileListElement // will be created. AS400 sys = new AS400(mySystem, myUserId, myPassword); // The FileTreeElment will properly create the text url and pass the // file and path information through the httpservletrequest. If the // list is meant to display the contents of the local file system, // then only pass the HttpServletRequest on the constructor. FileListElement fileList = new FileListElement(sys, httpservletrequest); // Output the content of the FileListElement. out.println(fileList.list());Once the contents are listed and a user traverses the HTML tree down to /QIBM/ProdData/Http/Public/ and clicks on the jt400 directory link, the FileListElement will look something like the following:
Name | Size | Type | Modified |
---|---|---|---|
../ (Parent Directory) | |||
com | Directory | 06/09/2000 11:00:46 AM | |
lib | Directory | 09/11/2000 10:32:24 AM | |
MRI2924 | Directory | 06/09/2000 11:03:12 PM | |
SSL128 | Directory | 09/22/2000 10:46:29 AM | |
SSL56 | Directory | 09/22/2000 10:43:52 PM | |
utilities | Directory | 06/09/2000 11:01:58 AM | |
ACCESS.LST | 15950 | File | 06/29/2000 06:26:25 PM |
ACCESS.LVL | 23 | File | 06/29/2000 06:26:09 PM |
CKSETUP.INI | 88 | File | 06/29/2000 06:26:21 PM |
GTXSETUP.ini | 102 | File | 05/16/2000 05:51:46 PM |
JT400.PKG | 19 | File | 09/08/1999 04:25:51 PM |
OPNAV.LST | 16827 | File | 09/08/1999 04:26:08 PM |
OPNAV.LVL | 19 | File | 05/16/2000 05:51:31 AM |
OPV4R5M0.LST | 24121 | File | 09/08/1999 04:26:14 PM |
OPV4R5M01.LST | 104 | File | 05/16/2000 05:51:46 AM |
PROXY.LST | 4636 | File | 09/08/1999 04:26:00 AM |
PROXY.LVL | 29 | File | 06/29/2000 06:26:26 AM |
PXV4R5M0.LST | 7101 | File | 09/08/1999 04:25:58 PM |
PXV4R5M01.LST | 38 | File | 06/29/2000 06:27:46 PM |
QSF631215769JC10004R05M00505000000005 | 4518 | File | 05/10/2000 10:35:10 AM |
QSF631215769JC10004R05M00505000000006 | 20 | File | 05/10/2000 10:35:00 AM |
QSF631215769JC10004R05M00505000000007 | 15 | File | 05/10/2000 10:35:19 AM |
QSF631215769JC10004R05M00505000000008 | 15950 | File | 05/10/2000 10:34:57 AM |
QSF631215769JC10004R05M00505000000009 | 38 | File | 05/10/2000 10:35:13 AM |
QSF631215769JC10004R05M00505000000010 | 38586 | File | 05/10/2000 10:35:06 AM |
QSF631215769JC10004R05M00505000000011 | 33 | File | 05/10/2000 10:35:09 AM |
QSF631215769JC10004R05M00505000000013 | 88 | File | 05/10/2000 10:35:03 AM |
READMEGT.TXT | 3480 | File | 05/16/2000 05:52:27 AM |
READMESP.TXT | 5161 | File | 06/29/2000 06:26:14 PM |
V4R5M0.LST | 38586 | File | 06/29/2000 06:26:19 PM |
V4R5M01.LST | 33 | File | 06/29/2000 06:26:33 PM |
V4R5M02.LST | 33 | File | 06/29/2000 06:26:26 PM |
FileListElement objects generate the following events:
DirFilter
,
FileListRenderer
,
Serialized FormConstructor and Description |
---|
FileListElement()
Constructs a default FileListElement object.
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request)
Constructs an FileListElement for an IBM i file system
using the pathInfo from the specified request, and
the designated system.
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request,
HTMLTable table)
Constructs an FileListElement with the specified system, request, and table.
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request,
java.lang.String parameterPathInfo)
Constructs an FileListElement for an IBM i file system
using the pathInfo from the specified request, and
the designated system.
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request,
java.lang.String shareName,
java.lang.String sharePath)
Constructs a FileListElement with the specified system, requst, NetServer sharePath, and
NetServer shareName.
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request,
java.lang.String shareName,
java.lang.String sharePath,
java.lang.String parameterPathInfo)
Constructs a FileListElement with the specified system, requst, NetServer sharePath, and
NetServer shareName.
|
FileListElement(javax.servlet.http.HttpServletRequest request)
Constructs an FileListElement for the local file system
using the pathInfo from the specified request.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.
|
java.text.Collator |
getCollator()
Returns the Collator.
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the Http servlet request.
|
FileListRenderer |
getRenderer()
Return the file list renderer.
|
java.lang.String |
getShareName()
Return the name of the NetServer share.
|
java.lang.String |
getSharePath()
Return the NetServer share point.
|
AS400 |
getSystem()
Returns the system.
|
HTMLTable |
getTable()
Returns the HTMLTable.
|
java.lang.String |
list()
Returns a string containing the list of files and directories
in the path defined in the HttpServletRequest.
|
java.lang.String |
list(HTMLTableConverter conv)
Returns a string containing the list of files and directories
in the path defined in the HttpServletRequest.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list.
|
void |
setCollator(java.text.Collator collator)
Sets the collator.
|
void |
setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Sets the Http servlet request for the element.
|
void |
setPatternMatching(int patternMatching)
Sets the pattern-matching behavior used when files are listed.
|
void |
setRenderer(FileListRenderer renderer)
Set the renderer for the FileListElement.
|
void |
setShareName(java.lang.String shareName)
Set the name of the NetServer share.
|
void |
setSharePath(java.lang.String sharePath)
Set the NetServer share path.
|
void |
setSystem(AS400 system)
Set the system.
|
void |
setTable(HTMLTable table)
Set the HTMLTable to use when displaying the file list.
|
void |
sort(boolean sort)
Sorts the list elements.
|
public FileListElement()
public FileListElement(javax.servlet.http.HttpServletRequest request)
request
- The Http servlet request.public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request)
system
- The system.request
- The Http servlet request.public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request, java.lang.String parameterPathInfo)
system
- The system.request
- The Http servlet request.parameterPathInfo
- public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request, HTMLTable table)
system
- The system.request
- The Http servlet request.table
- The HTML table.public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request, java.lang.String shareName, java.lang.String sharePath)
system
- The IBM i system.request
- The Http servlet request.shareName
- The NetServer share name.sharePath
- The NetServer share path.public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request, java.lang.String shareName, java.lang.String sharePath, java.lang.String parameterPathInfo)
system
- The IBM i system.request
- The Http servlet request.shareName
- The NetServer share name.sharePath
- The NetServer share path.parameterPathInfo
- public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public java.text.Collator getCollator()
public javax.servlet.http.HttpServletRequest getHttpServletRequest()
public FileListRenderer getRenderer()
public java.lang.String getSharePath()
public java.lang.String getShareName()
public AS400 getSystem()
public HTMLTable getTable()
public java.lang.String list()
public java.lang.String list(HTMLTableConverter conv)
conv
- An HTMLTableConverter used to format the list of files.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setCollator(java.text.Collator collator)
collator
- The Collator.public void setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
request
- The Http servlet request.public void setRenderer(FileListRenderer renderer)
renderer
- The file list renderer.public void setSharePath(java.lang.String sharePath)
sharePath
- The NetServer share path.public void setShareName(java.lang.String shareName)
shareName
- The NetServer share name.public void setSystem(AS400 system)
system
- The system.public void setTable(HTMLTable table)
table
- The HTML table.public void sort(boolean sort)
sort
- true if the elements are sorted; false otherwise.
The default is true.public void setPatternMatching(int patternMatching)
patternMatching
- Either PATTERN_POSIX
, PATTERN_POSIX_ALL
, or PATTERN_OS2