1
2
3
4
5
6
7 package nl.mineleni.cbsviewer.servlet;
8
9 import javax.servlet.ServletConfig;
10 import javax.servlet.ServletException;
11 import javax.servlet.http.HttpServlet;
12
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16
17
18
19
20
21
22 public abstract class AbstractBaseServlet extends HttpServlet {
23
24
25 public static final String USER_ID = "user_id";
26
27
28 public static final String USER_PASSWORD = "user_password";
29
30
31 private static final long serialVersionUID = 1L;
32
33
34 private static final Logger LOGGER = LoggerFactory
35 .getLogger(AbstractBaseServlet.class);
36
37 private transient String proxyHost;
38
39
40 private transient int proxyPort = -1;
41
42
43 private transient String userID;
44
45
46 private transient String passID;
47
48
49
50
51
52
53 public String getProxyHost() {
54 return this.proxyHost;
55 }
56
57
58
59
60
61
62 public int getProxyPort() {
63 return this.proxyPort;
64 }
65
66
67
68
69
70
71 public String getUserID() {
72 return this.userID;
73 }
74
75
76
77
78
79
80 public String getPassID() {
81 return this.passID;
82 }
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 @Override
98 public void init(final ServletConfig config) throws ServletException {
99 super.init(config);
100
101
102 this.proxyHost = System.getProperty("http.proxyHost");
103 try {
104 this.proxyPort = Integer.valueOf(System
105 .getProperty("http.proxyPort"));
106 } catch (final NumberFormatException e) {
107 LOGGER.debug("Geen proxy poort gedefinieerd.");
108 }
109 LOGGER.info("Instellen van proxy config: " + this.proxyHost + ":"
110 + this.proxyPort);
111
112
113 this.userID = config.getInitParameter(USER_ID);
114 this.passID = config.getInitParameter(USER_PASSWORD);
115 if (LOGGER.isDebugEnabled()) {
116 LOGGER.debug("User ID is: " + this.userID
117 + "; User password lengte is: "
118 + (null != this.passID ? this.passID.length() : "0"));
119 }
120 }
121 }