W3C home > Mailing lists > Public > www-jigsaw@w3.org > September to October 1996

Determining the DocRoot (Space Directory) at run-time.

From: Anselm Baird-Smith <abaird@w3.org>
Date: Thu, 5 Sep 1996 16:49:12 +0500
Message-Id: <9609052049.AA11489@www18.w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:25 GMT