Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java @ 9726:0a5239a1e46e 3.2.x
Upgrade to Log4j 2
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 02 Mar 2022 10:26:50 +0100 |
parents | 654aaa0d7576 |
children | cfc0aab9947f |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5871
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5871
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server; |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import java.io.IOException; |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import javax.servlet.ServletContext; |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import javax.servlet.ServletContextEvent; |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 import javax.servlet.ServletContextListener; |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 |
9726 | 17 import org.apache.logging.log4j.Logger; |
18 import org.apache.logging.log4j.LogManager; | |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
20 import org.dive4elements.river.client.server.features.Features; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.server.features.XMLFileFeatures; |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 /** |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 * ServletContextListenter to initalize the Features globally for |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 * all Servlets |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 */ |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 public class BaseServletContextListener implements ServletContextListener { |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 |
9726 | 29 private static final Logger log = LogManager.getLogger( |
8856 | 30 BaseServletContextListener.class); |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 @Override |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 public void contextInitialized(ServletContextEvent sce) { |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 ServletContext sc = sce.getServletContext(); |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 String filename = sc.getInitParameter("features-file"); |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
38 log.debug("Initializing ServletContext"); |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 try { |
8856 | 40 XMLFileFeatures features = new XMLFileFeatures( |
41 sc.getRealPath(filename)); | |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 sc.setAttribute(Features.CONTEXT_ATTRIBUTE, features); |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 } catch(IOException e) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
44 log.error(e); |
3478
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 } |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 } |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 @Override |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 public void contextDestroyed(ServletContextEvent sce) { |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 //DO NOTHING |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 } |
763789a9acca
Rename FeatureServletContextListener and move it out of the features package
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 } |