Mercurial > hg > digilib-old
annotate client/digitallibrary/ImgInfo-json.jsp @ 831:30037e93ec2a stream
helper function to show request and response header.
author | robcast |
---|---|
date | Fri, 25 Feb 2011 12:41:07 +0100 |
parents | 485b85f6e097 |
children |
rev | line source |
---|---|
753 | 1 <%@page language="java" |
758 | 2 import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile, |
3 digilib.util.ImageSize, digilib.servlet.DigilibConfiguration" | |
753 | 4 contentType="application/json"%><%! |
5 // create DocumentBean instance for all JSP requests | |
6 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); | |
7 | |
8 // initialize DocumentBean instance in JSP init | |
9 public void jspInit() { | |
10 try { | |
11 // set servlet init-parameter | |
12 docBean.setConfig(getServletConfig()); | |
13 } catch (javax.servlet.ServletException e) { | |
14 System.out.println(e); | |
15 } | |
16 } | |
17 %><% | |
18 // parsing the query | |
19 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); | |
20 docBean.setRequest(dlRequest); | |
21 // dir cache | |
22 digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); | |
23 digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); | |
24 // get file | |
25 FileOps.FileClass fc = FileOps.FileClass.IMAGE; | |
758 | 26 ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc); |
753 | 27 |
754
ce5a0e6b5ee9
reading image info asynchronously works now. has just no use yet.
robcast
parents:
753
diff
changeset
|
28 %>{ <% |
753 | 29 if (imgFile != null) { |
758 | 30 ImageFile img = (ImageFile) imgFile.getBiggest(); |
753 | 31 ImageSize imgSize = img.getSize(); |
32 %> | |
33 "filename" : "<%= imgFile.getName() %>", | |
34 "aspect" : <%= imgFile.getAspect() %>, | |
35 "dpi_x" : <%= imgFile.getResX() %>, | |
36 "dpi_y" : <%= imgFile.getResY() %><% | |
37 | |
38 if (imgSize != null) { | |
39 %>, | |
40 "width" : <%= imgSize.getWidth() %>, | |
41 "height" : <%= imgSize.getHeight() %> | |
42 <% } | |
43 } | |
44 %>} |