comparison client/digitallibrary/digicat.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 36505ac4a334
children b877e54b0794
comparison
equal deleted inserted replaced
59:8d9a0abf3626 60:58d23f512c80
1 <%@ page language="java" %>
2
3 <%!
4 // authentication stuff - robert
5 // -----------------------------
6 // create DocumentBean instance for all JSP requests
7 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
8
9 // initialize DocumentBean instance in JSP init
10 public void jspInit() {
11 try {
12 // set servlet init-parameter
13 docBean.setConfig(getServletConfig());
14 } catch (javax.servlet.ServletException e) {
15 System.out.println(e);
16 }
17 }
18 %>
19
20 <%
21 // check if authentication is needed and redirect if necessary
22 docBean.doAuthentication(request, response);
23
24 // set up request object for base URL
25 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest();
26 dlRequest.setBaseURL(request);
27
28 %>
29
1 <html> 30 <html>
2 <head> 31 <head>
3 32
4 <jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" />
5
6 <%
7 // set servlet init-parameter
8 DB.setConfig(getServletConfig());
9 // check if authentication is needed and redirect if necessary
10 DB.doAuthentication(request, response);
11
12 // calculate base URL string from request (minus last part)
13 String baseUrl = request.getRequestURL().toString();
14 int eop = baseUrl.lastIndexOf("/");
15 if (eop > 0) {
16 baseUrl = baseUrl.substring(0, eop);
17 } else {
18 baseUrl = "http://" + request.getServerName() + "/docuserver/digitallibrary";
19 }
20
21 %>
22
23 <script language="JavaScript"> 33 <script language="JavaScript">
24 34
25 var baseUrl = "<%= baseUrl %>"; 35 var baseUrl = "<%= dlRequest.getBaseURL() %>";
26 36
27 // DEBUG 37 // DEBUG
28 //alert('DIR: <%= DB.getDocuPath(request) %> PAGES: <%= DB.getNumPages(request) %>'); 38 //alert('DIR: <%= docBean.getDocuPath(request) %> PAGES: <%= docBean.getNumPages(request) %>');
29 39
30 // the document's query string (minus "?") 40 // the document's query string (minus "?")
31 var query = location.search.substring(1); 41 var query = location.search.substring(1);
32 42
33 // first page number 43 // first page number
34 var firstPage = <%= DB.getFirstPage(request) %>; 44 var firstPage = <%= docBean.getFirstPage(request) %>;
35 45
36 // number of pages of the document 46 // number of pages of the document
37 var numPages = <%= DB.getNumPages(request) %>; 47 var numPages = <%= docBean.getNumPages(request) %>;
38 48
39 // browser version test to include the corresponding navigation-file 49 // browser version test to include the corresponding navigation-file
40 if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) { 50 if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) {
41 top.document.write('<script src="navcat_n4.js"><\/script>'); 51 top.document.write('<script src="navcat_n4.js"><\/script>');
42 } else if (navigator.appName.toLowerCase() == "netscape") { 52 } else if (navigator.appName.toLowerCase() == "netscape") {