Mercurial > hg > digilib-old
view client/digitallibrary/ImgInfo-json.jsp @ 890:613c2089bc7a jquery
use setstate in redisplay instead of pushstate as long as we don't deal with popstate (i.e. history-back).
author | robcast |
---|---|
date | Thu, 07 Apr 2011 10:22:26 +0200 |
parents | 485b85f6e097 |
children |
line wrap: on
line source
<%@page language="java" import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile, digilib.util.ImageSize, digilib.servlet.DigilibConfiguration" contentType="application/json"%><%! // 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); } } %><% // parsing the query digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); docBean.setRequest(dlRequest); // dir cache digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); // get file FileOps.FileClass fc = FileOps.FileClass.IMAGE; ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc); %>{ <% if (imgFile != null) { ImageFile img = (ImageFile) imgFile.getBiggest(); ImageSize imgSize = img.getSize(); %> "filename" : "<%= imgFile.getName() %>", "aspect" : <%= imgFile.getAspect() %>, "dpi_x" : <%= imgFile.getResX() %>, "dpi_y" : <%= imgFile.getResY() %><% if (imgSize != null) { %>, "width" : <%= imgSize.getWidth() %>, "height" : <%= imgSize.getHeight() %> <% } } %>}