ObjectBox servlet and WARs

"Ken McCloskey" <[email protected]> Wed, 27 Aug 2003 01:48:11 +0000
Newsgroups gmane.text.xml.o-xml
Message-ID <[email protected]>
Martin,

Just wanted to bring your attention to a problem I encountered when trying 
to use the ObjectBox servlet from within the context of a WAR file.

The problem occurs in the method init of org.oXML.extras.http.ObjectBox:

baseurl = servletConfig.getServletContext().getRealPath("/");

which will return null if called from within a WAR. My solution was to check 
for the null, and if it is encountered do the following:

java.net.URL baseurlURL = 
servletConfig.getServletContext().getResource("/");
baseurl = baseurlURL.toString();

On Tomcat, this will return a jndi reference to inside the WAR which seems 
to work ok.

Ken McCloskey

_________________________________________________________________
Get MSN 8 and help protect your children with advanced parental controls.  
http://join.msn.com/?page=features/parental