annotate servlet/src/digilib/Utils.java @ 71:d493563ef672

New servlet version 1.5b. Mostly cleanup. Global parameters for digilib now in DigilibConfiguration, per request parameters are now all in DigilibRequest. The DocuImage implementation can be selected by the configuration docuimage-class. Pixel-by-pixel view implemented with "mo=clip".
author robcast
date Fri, 24 Jan 2003 21:40:59 +0100
parents 8d9a0abf3626
children 5d44cd2481a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
1 /* Utils -- general utility classes for scaler servlet
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
2
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
3 Digital Image Library servlet components
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
4
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
5 Copyright (C) 2001, 2002 Robert Casties (robcast@mail.berlios.de)
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
6
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
7 This program is free software; you can redistribute it and/or modify it
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
9 Free Software Foundation; either version 2 of the License, or (at your
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
10 option) any later version.
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
11
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
12 Please read license.txt for the full details. A copy of the GPL
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
13 may be found at http://www.gnu.org/copyleft/lgpl.html
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
14
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
16 along with this program; if not, write to the Free Software
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
18
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
19 */
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
20
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
21 package digilib;
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
22
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
23 public class Utils {
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
24
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
25 public Utils() {
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
26 }
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
27
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
28 public Utils(int dbg) {
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
29 debugLevel = dbg;
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
30 }
59
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
31
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
32 public static int debugLevel = 10;
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
33 public void setDebugLevel(int lvl) {
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
34 debugLevel = lvl;
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
35 }
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
36 public int getDebugLevel() {
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
37 return debugLevel;
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
38 }
8d9a0abf3626 Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents: 1
diff changeset
39
1
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
40 /**
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
41 * Debugging help
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
42 * dprintln(1, "blabla");
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
43 * will be printed on stdout if debug >= 1
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
44 */
71
d493563ef672 New servlet version 1.5b.
robcast
parents: 59
diff changeset
45 public void dprintln(int dbg, String s) {
1
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
46 if (debugLevel >= dbg) {
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
47 String ind = "";
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
48 // indent by debuglevel
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
49 for (int i = 0; i < dbg; i++) {
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
50 ind += " ";
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
51 }
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
52 System.out.println(ind+s);
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
53 }
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
54 }
0ff3ede32060 Initial revision
robcast
parents:
diff changeset
55 }