You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by p2...@garethwestern.com on 2004/04/07 20:58:49 UTC

InterServlet -> Axis communication

Hi,
I have a servlet which adds an object to an attribute in it's servlet context in
Tomcat. How can I access that context from a service in the Axis Servlet? When
I check the Axis servlet context attributes using:

(context is the current MessageContext)
javax.servlet.ServletContext foo =
((javax.servlet.http.HttpServlet)context.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLET)).getServletContext();

the attribute that I specified in my other servlet is not listed. So I assume
this is because they are seperate contexts. Is there any way I can get an
attribute from one to the other?

I don't understand enough about context :\

Re: InterServlet -> Axis communication

Posted by Gareth Western <p2...@garethwestern.com>.
 Ah cool. Thank you.... but now the problem is that the returned value 
is always null. I guess, from what i've read, that this is happening 
because the crossContext value for Axis is false (as it explains on 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html). 
How do I configure Axis to set this value to true (ignoring security 
implications for the time being)? I tried adding a Context attribute to 
the Axis/WEB-INF/web.xml as follows:
<web-app>
    ...
    <Context crossContext="true"/>
</web-app>
but i'm guessing this isn't the correct usage, as I'm still getting a 
null value?

Dario Di Minno wrote:

> you can get the context of another servlet in this way:
>
> ServletContext myServletContext = sc.getContext("http://myServletURL");
>
> and then set/get its attributes
>
> Dario
>


Re: InterServlet -> Axis communication

Posted by Dario Di Minno <da...@yahoo.it>.
p2p@garethwestern.com ha scritto:

>Hi,
>I have a servlet which adds an object to an attribute in it's servlet context in
>Tomcat. How can I access that context from a service in the Axis Servlet? When
>I check the Axis servlet context attributes using:
>
>(context is the current MessageContext)
>javax.servlet.ServletContext foo =
>((javax.servlet.http.HttpServlet)context.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLET)).getServletContext();
>
>the attribute that I specified in my other servlet is not listed. So I assume
>this is because they are seperate contexts. Is there any way I can get an
>attribute from one to the other?
>
>I don't understand enough about context :\
>
>  
>
you can get the context of another servlet in this way:

ServletContext myServletContext = sc.getContext("http://myServletURL");

and then set/get its attributes

Dario