-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

you can also use java.util.Properties for this, and have each zone use it's
own file.
I set the init args parameter "config.file", and set everything in that
file.
This also works great for if you develop on one enviornment, and deploy in
another.

i.e. (zone file)
servlet.<SERVLET NAME
HERE>.initArgs=config.file=d:\\apache\\development\\init.args

i.e. (servlet.init())
Properties props = new Properties();
try {
    props.load(new FileInputStream(getInitParameter("config.file")));
} catch (IOException ioe) {
}


Hope this helps.

Noah Nordrum
Carpe Diem. A fish a day keeps the doctor away.

----- Original Message -----
From: Craig R. McClanahan <[EMAIL PROTECTED]>
To: Java Apache Users <[EMAIL PROTECTED]>
Sent: Monday, September 13, 1999 12:38 PM
Subject: Re: System.getProperty() with multiple zones.


> -----------------------------
> Please read the FAQ!
> <http://java.apache.org/faq/>
> -----------------------------
>
> Daryn Nakhuda wrote:
>
> > -----------------------------
> > Please read the FAQ!
> > <http://java.apache.org/faq/>
> > -----------------------------
> >
> > Any suggestions on how to store seperate sets of properties for two
zones
> > running under one jserv engine?
> >
>
> The standard servlet approach to this issue is to use initialization
arguments
> to your servlets, instead of system properties.
>
> Each zone has a zone properties file which can include, among other
things,
> declarations of the servlets that run inside it.  You can easily run the
same
> servlet code, with different properties, by passing init arguments like
this:
>
>     servlet.myservlet.code=com.mycompany.mypackage.MyServlet
>     servlet.myservlet.initArgs=arg1=value1,arg2=value2
>
> Then, in the init() method of your servlet, go grab the arguments with
code
> like this:
>
>     public void init(ServletConfig config) throws ServletException {
>
>         super(config);
>         String arg1 = config.getInitParameter("arg1");
>         ... do something with this ...
>         String arg2 = config.getInitParameter("arg2");
>         ... do something with this ...
>
>     }
>
> In the zone properties file for the second zone, just use the property
values
> that are relevant in this zone instead.
>
> At runtime, you will have two instances of the servlet -- one per zone --
each
> configured according to its own initialization parameters.
>
> >
> > As it is now, we have a "master" servlet that is run in both zones, and
sets
> > the system properties from the appropriate properties file.
> >
>
> System properties have the same restriction as Singleton Pattern
> implementations -- there's only one set of them :-).  See above for the
> appropriate solution.
>
> Craig McClanahan
>
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to