Hi
Figured it out on my own. To get the [TOMCATPATH]/conf/context.xml
contents:
String infoOfInterest;
HttpServlet servletContext =
(HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
ServletConfig servletConfig =
servletContext.getServletConfig();
ServletContext context = servletConfig.getServletContext();
infoOfInterest = context.getInitParameter("name-of-param");
Thanks anyway.
Lenny Wintfeld
Lenny Wintfeld wrote:
Hi
I've been trying (and failing so far) to get an init parameter from
axis in my web services method.
Ideally I'd like to get the init parameter value from
[TOMCATPATH]/conf/context.xml
If that's not possible I could get it from
[TOMCATPATH]/webapps/axis/WEB-INF/web.xml
or from [TOMCATPATH]/webapps/axis/WEB-INF/context.xml.
The code I've been trying to use (unsucessfully) to do this, is at the
start of the web services method implementation in
[MyService]BindingImpl.java :
String infoOfInterest;
HttpServlet servletContext =
(HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
infoOfInterest = servletContext.getInitParameter(
"admin_dir_prefix");
The code snippet shown above compiles and runs fine but the call to
getInitParameter("admin_dir_prefix") always returns null.
The [TOMCATPATH]/conf/context.xml and the
[TOMCATPATH]/webapps/axis/WEB-INF/context.xml.
bot look like:
<Context allowLinking="true" disableProxyCaching="true"
cachingAllowed="false">
--STUFF--
<Parameter name="admin_dir_prefix" value="/home/pkg"
override="false"/>
--STUFF
</Context>
The [TOMCATPATH]/webapps/axis/WEB-INF/web.xml looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
--LOTS OF STUFF--
<context-param>
<param-name>admin_dir_prefix</param-name>
<param-value>/CecilRepServer/pkg</param-value>
</context-param>
</web-app>
Can someone tell me what I'm doing wrong and or how to go about
getting a Parameter "value", given it's "name" from any of the above
xml files?
Preferably from the [TOMCATPATH]/conf/context.xml, but at this point,
I'd be happy to get it from anywhere !
Thanks in advance for any advice or any corrections to my code or
xml's that might get this to work.
Lenny Wintfeld
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]