01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20:
21: package com.salmonllc.servlets;
22:
23: import com.salmonllc.properties.Props;
24:
25: import javax.servlet.*;
26: import javax.servlet.http.*;
27:
28: /**
29: * This class can be used to set the salmon properties path without the -D command line switch
30: * To use it, add this servlet to the web.xml file of one of your web applications. Then add the init property
31: * salmon.props.path and use it to specify the properties.
32: * <servlet>
33: * <servlet-name>SalmonPropsPath</servlet-name>
34: * <servlet-class>com.salmonllc.servlets.SalmonPropsPath</servlet-class>
35: * <load-on-startup>1</load-on-startup>
36: * <init-param>
37: * <param-name>salmon.props.path</param-name>
38: * <param-value> PATH_DIRECTORY </param-value>
39: * </init-param>
40: * </servlet>
41: */
42: public class SalmonPropsPath extends HttpServlet {
43:
44: public void init(ServletConfig sc) throws ServletException {
45: String salmonPropsPath = sc
46: .getInitParameter(Props.SYS_PROPS_DIR_PROPERTY);
47: Props.setPropsPath(salmonPropsPath, true);
48: super.init(sc);
49: }
50:
51: }
|