Mercurial > hg > digilib-old
changeset 234:aa1920322b1a
Servlet version 1.19b1 -- with context metadata
- reads and caches context tags from index meta file
- for use in dlContext-xml.jsp
author | robcast |
---|---|
date | Sat, 17 Jul 2004 19:29:48 +0200 |
parents | e40d8b2e3978 |
children | b632a25e1753 |
files | client/digitallibrary/dlContext-xml.jsp |
diffstat | 1 files changed, 43 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/dlContext-xml.jsp Sat Jul 17 19:29:48 2004 +0200 @@ -0,0 +1,43 @@ +<%@ 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"); + +%><!-- Automatically generated XML snippet with document context --> +<result> +<% +int pn = dlRequest.getAsInt("pn"); +String fn = dlRequest.getFilePath(); +String ctx = ""; +digilib.io.DocuDirent f = dirCache.getFile(fn, pn, digilib.io.FileOps.CLASS_IMAGE); +if (f != null) { + //ctx = "hasfile:"+f.getName(); + f.checkMeta(); + java.util.HashMap meta = f.getFileMeta(); + if (meta != null) { + //ctx = "JSP:hasmeta!"; + if (meta.containsKey("context")) { + ctx = (String) meta.get("context"); + } + } +} +%><%= ctx %> +</result>