-----------------------------
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]