On Tue, 5 Jun 2001, [ISO-8859-1] Luís[ISO-8859-1] Góis wrote:

> Hello, Robert!
> 
> I'm also interested in getting properties for cocoon logicsheets loaded at Cocoon 
>startup. I'm using Cocoon 1, but do you already have any working solution or clue 
>about how to make this work? 
> 
[snip]
> 
> >     How can I get some properties or initargs into documents being
> processed
> > > by Cocoon2 without haing to reload a properties file on every request?
> > > Since none of the files in my application except cocoon run as a
> servlet, I
> > > can't pass initargs, can I?  And since none of them stick around for
> more
> > > than a single request, I can't load a properties file once and stick
> with
> > > those values, right?  How are people setting properties for Cocoon2
> > > applications?

What I decided to do is have my properties file ina directory in the CLASSPATH.

CLASSPATH=$CLASSPATH:/etc/myapp

/etc/myapp:
  my.props


Then I can access it like so:

InputStream in = ClassLoader.getSystemResourceAsStream("my.props");
Properties props = new Properties();
props.load(in);
String foo = props.getProperty("my.foo");
String bar = props.getProperty("my.foo.bar");
String baz = props.getProperty("baz.baz.baz");

-- 
Robert Dale





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to