Mercurial > hg > digilib-old
diff client/src/main/webapp/dlInfo-json.jsp @ 892:ba1eb2d821a2 mvnify
rearrange sources to maven directory standard
author | robcast |
---|---|
date | Tue, 19 Apr 2011 18:44:25 +0200 |
parents | client/digitallibrary/dlInfo-json.jsp@39bd5128811c |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/main/webapp/dlInfo-json.jsp Tue Apr 19 18:44:25 2011 +0200 @@ -0,0 +1,36 @@ +<%@ 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); + } +} +%><% +// parsing the query +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); +docBean.setRequest(dlRequest); +%> +// JSON format metadata about request and image +{ +<% + Object[] keys = dlRequest.getParams().keySet().toArray(); + java.util.Arrays.sort(keys); + int l = keys.length; + for (int i = 0; i < l; i++) { + String key = (String) keys[i]; + String val = dlRequest.getAsString(key); + if (val.length() == 0) { + val = ""; + } + %>"<%= key %>" : "<%= val %>", +<% + } +%> +}