annotate flys-client/src/main/java/de/intevation/flys/client/server/BaseServlet.java @ 3386:b5930486594d

Added new titles for 'fix_vollmer_wq_curve' Output; let it use NaviChartOutputTab. flys-client/trunk@5136 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 26 Jul 2012 10:46:12 +0000
parents fba76f4afca9
children
rev   line source
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.server;
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import javax.servlet.ServletException;
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import javax.servlet.http.HttpServlet;
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
2890
fba76f4afca9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1417
diff changeset
8 /** Documentation goes here. */
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 public class BaseServlet extends HttpServlet {
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 private static Logger logger = Logger.getLogger(BaseServlet.class);
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
1372
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
14 public static final String LOG4J_PROPERTIES = "FLYS_CLIENT_LOG4J_PROPERIES";
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
15
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
16
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 @Override
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 public void init()
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 throws ServletException
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 {
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 System.out.println("BaseServlet.init");
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
1368
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
23 initLogging();
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
24 initConfigParameters();
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
25 }
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
26
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
27
2890
fba76f4afca9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1417
diff changeset
28 /** Init servlet wide logging. */
1368
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
29 protected void initLogging() {
1372
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
30 String log4jProperties = System.getenv(LOG4J_PROPERTIES);
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
31
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
32 if (log4jProperties == null || log4jProperties.length() == 0) {
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
33 String file = getInitParameter("log4j-properties");
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
34
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
35 if (file != null && file.length() > 0) {
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
36 log4jProperties = getServletContext().getRealPath(file);
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
37 }
2ba44c1b2bab Added a environment variable that might be used to use an alternative log4j properties file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1368
diff changeset
38 }
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
1417
42d6cf6e10b7 Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1372
diff changeset
40 LoggingConfigurator.init(log4jProperties);
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 }
1368
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
42
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
43
2890
fba76f4afca9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1417
diff changeset
44 /** Set Context Attribute (parameter) from config.xml file. */
1368
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
45 protected void initConfigParameters() {
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
46 String url = getInitParameter("server-url");
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
47 logger.debug("Found server url: " + url);
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
48
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
49 getServletContext().setAttribute("server-url", url);
ec0c81f2c7a4 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1366
diff changeset
50 }
1366
d0eb2202ffbe Added a BaseServlet that is used to setup config things like log4j.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 }
1417
42d6cf6e10b7 Moved code to parse WMS Capabilities to an own class 'CapabilitiesParser' and added code to parse SRS definitions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1372
diff changeset
52 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org