annotate client/digitallibrary/ImgInfo-json.jsp @ 869:5396529b3f46 jquery

treat arrows as normal buttons; factor out createButton()
author hertzhaft
date Thu, 17 Mar 2011 12:20:36 +0100
parents c36027f01968
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
746
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
1 <%@page language="java"
751
c36027f01968 fixed jsp to work with new classes.
robcast
parents: 747
diff changeset
2 import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile,
c36027f01968 fixed jsp to work with new classes.
robcast
parents: 747
diff changeset
3 digilib.util.ImageSize, digilib.servlet.DigilibConfiguration"
746
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
4 contentType="application/json"%><%!
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
5 // create DocumentBean instance for all JSP requests
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
6 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
7
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
8 // initialize DocumentBean instance in JSP init
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
9 public void jspInit() {
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
10 try {
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
11 // set servlet init-parameter
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
12 docBean.setConfig(getServletConfig());
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
13 } catch (javax.servlet.ServletException e) {
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
14 System.out.println(e);
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
15 }
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
16 }
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
17 %><%
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
18 // parsing the query
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
19 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
20 docBean.setRequest(dlRequest);
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
21 // dir cache
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
22 digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig();
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
23 digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache");
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
24 // get file
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
25 FileOps.FileClass fc = FileOps.FileClass.IMAGE;
751
c36027f01968 fixed jsp to work with new classes.
robcast
parents: 747
diff changeset
26 ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc);
746
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
27
747
5d3da97089bc reading image info asynchronously works now. has just no use yet.
robcast
parents: 746
diff changeset
28 %>{ <%
746
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
29 if (imgFile != null) {
751
c36027f01968 fixed jsp to work with new classes.
robcast
parents: 747
diff changeset
30 ImageFile img = (ImageFile) imgFile.getBiggest();
746
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
31 ImageSize imgSize = img.getSize();
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
32 %>
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
33 "filename" : "<%= imgFile.getName() %>",
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
34 "aspect" : <%= imgFile.getAspect() %>,
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
35 "dpi_x" : <%= imgFile.getResX() %>,
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
36 "dpi_y" : <%= imgFile.getResY() %><%
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
37
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
38 if (imgSize != null) {
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
39 %>,
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
40 "width" : <%= imgSize.getWidth() %>,
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
41 "height" : <%= imgSize.getHeight() %>
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
42 <% }
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
43 }
e280bc2c9be1 first real JSON jsp: ImgInfo-json.jsp
robcast
parents:
diff changeset
44 %>}