diff client/digitallibrary/dlImage.jsp @ 60:58d23f512c80

New DigilibServlet.jar with new version (with DigilibRequest object). Changes in digilib, digicat, dlImage JSP. Initialization now done only once in jspInit. Uses DigilibRequest object to convert old +++-style requests to parameter-style requests and for BaseURL. Prettyfied config files (no authentication is default).
author robcast
date Wed, 28 Aug 2002 20:17:35 +0200
parents 866e798e2bef
children b877e54b0794
line wrap: on
line diff
--- a/client/digitallibrary/dlImage.jsp	Wed Aug 28 20:00:21 2002 +0200
+++ b/client/digitallibrary/dlImage.jsp	Wed Aug 28 20:17:35 2002 +0200
@@ -27,54 +27,32 @@
 <%
 } else {
 
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest();
 // default values for parameters
-String fn = "/";					// url of the page/document
-String pn = "1";					// page number
-String ws = "1";					// scale factor
-String mo = "";						// special options like 'fit' for gifs
-String mk = "0/0";					// marks
-String wx = "0";					// left edge of image (float from 0 to 1)
-String wy = "0";					// top edge in image (float from 0 to 1)
-String ww = "1";					// width of image (float from 0 to 1)
-String wh = "1";					// height of image (float from 0 to 1)
-String dw = "";						// width of client in pixels
-String dh = "";						// height of client in pixels
-
-String pt = "";						// (module pagesTotal.js) total number of pages
-
+dlRequest.setFn("/");					// url of the page/document
+dlRequest.setPn(1);					// page number
+dlRequest.setWs(1);					// scale factor
+dlRequest.setMo("");					// special options like 'fit' for gifs
+dlRequest.setMk("0/0");					// marks
+dlRequest.setWx(0);					// left edge of image (float from 0 to 1)
+dlRequest.setWy(0);					// top edge in image (float from 0 to 1)
+dlRequest.setWw(1);					// width of image (float from 0 to 1)
+dlRequest.setWh(1);					// height of image (float from 0 to 1)
 // overrriding default parameters with provided parameters from query-string
-if (request.getParameter("fn") != null) fn = request.getParameter("fn");
-if (request.getParameter("pn") != null) pn = request.getParameter("pn");
-if (request.getParameter("ws") != null) ws = request.getParameter("ws");
-if (request.getParameter("mo") != null) mo = request.getParameter("mo");
-if (request.getParameter("mk") != null) mk = request.getParameter("mk");
-if (request.getParameter("wx") != null) wx = request.getParameter("wx");
-if (request.getParameter("wy") != null) wy = request.getParameter("wy");
-if (request.getParameter("ww") != null) ww = request.getParameter("ww");
-if (request.getParameter("wh") != null) wh = request.getParameter("wh");
-if (request.getParameter("dw") != null) dw = request.getParameter("dw");
-if (request.getParameter("dh") != null) dh = request.getParameter("dh");
-if (request.getParameter("pt") != null) pt = request.getParameter("pt");
+dlRequest.setWithRequest(request);
 
 //String imageLocation = "http://" + request.getServerName() + "/docuserver/digitallibrary/servlet/Scaler/" + fn + "?pn=" + pn + "&ws=" + ws + "&mo=" + mo + "&wx=" + wx + "&wy=" + wy + "&ww=" + ww + "&wh=" + wh + "&dw=" + dw + "&dh=" + dh;
 
-String baseUrl = request.getRequestURL().toString();
-int eop = baseUrl.lastIndexOf("/");
-if (eop > 0) {
-    baseUrl = baseUrl.substring(0, eop);
-} else {
-    baseUrl = "http://" + request.getServerName() + "/docuserver/digitallibrary";
-}
+String baseUrl = dlRequest.getBaseURL();
 
-String imageLocation = baseUrl + "/servlet/Scaler/" + fn + "?pn=" + pn + "&ws=" + ws + "&mo=" + mo + "&wx=" + wx + "&wy=" + wy + "&ww=" + ww + "&wh=" + wh + "&dw=" + dw + "&dh=" + dh;
-
+String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString();
 %>
 
 <html>
 <head>
 <script language="JavaScript">
 
-var baseUrl = "<%= baseUrl %>";
+var baseUrl = "<%= dlRequest.getBaseURL() %>";
 
 // browser version test to include the corresponding navigation-file
 if (navigator.userAgent.toLowerCase().indexOf("opera") > -1) {
@@ -96,7 +74,7 @@
 
 </script>
 </head>
-<body bgcolor="#666666" onload='init_pagesTotal("<%= fn %>", "<%= pn %>", "<%= ws %>", "<%= mo %>", "<%= mk %>", "<%= wx %>", "<%= wy %>", "<%= ww %>", "<%= wh %>", "<%= pt %>")'>
+<body bgcolor="#666666" onload='init_pagesTotal("<%= dlRequest.getFn() %>", "<%= dlRequest.getPn() %>", "<%= dlRequest.getWs() %>", "<%= dlRequest.getMo() %>", "<%= dlRequest.getMk() %>", "<%= dlRequest.getWx() %>", "<%= dlRequest.getWy() %>", "<%= dlRequest.getWw() %>", "<%= dlRequest.getWh() %>", "<%= dlRequest.getPt() %>")'>
 
 <div id="lay1" style="position: absolute; left: 10px; top: 10px; visibility: visible"><img name="pic" src="<%= imageLocation %>" border="0"></div>