cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dale <rd...@digital-mission.com>
Subject Re: [C2] Properties or Initargs for cocoon documents
Date Tue, 05 Jun 2001 22:54:26 GMT
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message