view gnv/src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java @ 1022:28a0628b11b0

Added license file and license header. gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:15:08 +0000
parents d98d3e82118c
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.gnv.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.apache.struts.action.ActionServlet;

import de.intevation.gnv.propertiesreader.PropertiesReaderFactory;

/**
 * The GNV ActionServlet.
 * This Servelt will be used to handle all requests which are
 * send to the GNV-WebClient.
 *
 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
 */
public class GNVActionServlet extends ActionServlet {

    /**
     * the logger, used to log exceptions and additonaly information
     */
    private static Logger log = null;

    /**
     * The id which must be used to lookup the path to the 
     * <code>log4j.properties</code> file which is configured 
     * in the <code>web.xml</code>
     */
    private final static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv." +
                                                  "servlet.log4j.configuration";

    /**
     * The UID of this class.
     */
    private static final long serialVersionUID = 3597396283436383943L;


    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        try {
            String path = config.getServletContext().getRealPath("/")
                          + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID);
            PropertyConfigurator.configure(path);
            log = Logger.getLogger(GNVActionServlet.class);
        } catch (Exception e) {
            log.error(e, e);
        }
        log.info("PropertiesReader will be configured.");
        PropertiesReaderFactory.getInstance().initPropertiesReader(config);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org