Mercurial > hg > digilib-old
changeset 215:b5d395331f24
directory listing in XML
author | robcast |
---|---|
date | Tue, 29 Jun 2004 11:59:11 +0200 |
parents | 0e841edf6c39 |
children | 050fa739066f |
files | client/digitallibrary/dirInfo-xml.jsp |
diffstat | 1 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/dirInfo-xml.jsp Tue Jun 29 11:59:11 2004 +0200 @@ -0,0 +1,42 @@ +<%@ page language="java" %><%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><?xml version="1.0" encoding="UTF-8" ?> +<% +// process request +// get digilib config +digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); +// parsing the query +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); +// dir cache +digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); +// get directory +digilib.io.DocuDirectory dir = dirCache.getDirectory(dlRequest.getFilePath()); + +%><!-- Automatically generated XML snippet with directory info --> +<dir><% if (dir != null) { %> + <name><%= dir.getDirName() %></name> + <fsname><%= dir.getDir().getPath() %></fsname> +<% + int l = dir.size(); + for (int i = 0; i < l; i++) { + digilib.io.DocuDirent f = dir.get(i); +%> <file> + <index><%= i+1 %></index> + <name><%= (f != null) ? f.getBasename() : "null" %></name> + <fsname><%= (f != null) ? f.getName() : "null" %></fsname> + </file> +<% + } // for + } // if dir +%></dir>