Mercurial > hg > digilib-old
view client/digitallibrary/ImgInfo-json.jsp @ 810:5de6c7a73855 stream
Alternative versions of Scaler without async and without threads.
Should still work with Servlet API 2.3 (i.e. Tomcat < 7, Jetty < 8).
author | robcast |
---|---|
date | Sun, 20 Feb 2011 19:34:05 +0100 |
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() %> <% } } %>}