- From: Anselm Baird-Smith <abaird@w3.org>
- Date: Thu, 5 Sep 1996 16:49:12 +0500
- To: sbh@atg.andor.com
- Cc: www-jigsaw@w3.org
Steve Herndon writes: > I'm writing a Filter which needs to be able to determine what the > document root of its Jigsaw server is at run-time. I have figured out > how to do this in an instance of my Filter class, given a Request > object. You don't really need a request objec to do that: filter.getTargetResource().getServer().getRoot() will do it. > The problem is that I'd like to be able to figure it out when > the static initializer of my Filter is called so it only has to be done > once. Can anyone offer suggestion(s) on how to accomplish this? Basically, you cannot. You have to overide the initialize method of your filter, and do your init there. Something like: public void initialize(Object values[]) { super.initialize(values); // Now you can reach whatever you want: HTTPResource root = getTargetResource().getServer().getRoot(); ...; } As far as performances are concerned, this is equivalent to a static initializer, you just have to write this way if you want that infos. Anselm.
Received on Thursday, 5 September 1996 16:49:21 UTC