users@glassfish.java.net

Virtual-server properties - is there any way to access from JSP/Servlet/WS?

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Oct 2009 10:59:03 PDT

I want two virtual servers to have different behavior. They will be supporting different domain/URL access to the same WAR (though the behavior varies a little). To do this I need to define some property somewhere so I know which virtual-server is which.

The logical place seemed to be the add property ability (admin GUI or edit domain.xml) for each virtual server. However, I can find no way at runtime, in any of JSP/WS/Java/Servlet to access this information.

It appears these properties are only for a "fixed" known set of properties/behaviors. I have not found documentation that says that, but that's all I see they can do.

So I tried using contextXmlDefault. But, that doesn't help. Since the same WAR is intended to work on both virtual servers, and the Context is loaded at init time, it finds any/all property in either Context (and if the property is in both, it uses apparently whatever was most recently cached). So this does not distinguish the virtual-server for me.

Bottom line, these or any way, I have not yet found how to tell what virtual-server I am running under, so I can control behavior. About 3 days of trying so far (which I only mention so you know I didn't jump right to forum help after 20 minutes of trying).

I feel like this must be doable and I must be missing something fairly obvious.

Am I?

Thanks,
... Roger
[Message sent by forum member 'rlblanken' (rlblanken_at_egh.com)]

http://forums.java.net/jive/thread.jspa?messageID=367336