tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naga Yerramsetti <n...@tems.com>
Subject Re: Servlet Collaboration
Date Mon, 12 Jun 2000 16:27:59 GMT
Thanks for the response. I may not have explained well. My problem is this.

Consider this

Two servlets running  in different servlet contexts, ServletA in contextA and servletB in
contextB.
in servletA if I have


SomeClassA objA = new SomeClassA();
getServleteContext().setAttribute("attribute1",objA);

and in SevletB can I get handle  to objA using :

SomeClassA aliasObjA = getServletContext.getContext(<<URI for SevleletA>>);

"Craig R. McClanahan" wrote:

> Naga Yerramsetti wrote:
>
> > Is it possible for a servlet to access servlet from another context.
> >
>
> What precisely do you mean by "access"?  If you mean "can I get a reference to a servlet
instance
> in another context", the answer is no -- you cannot even get a reference to a servlet
instance in
> your own context.
>
> >
> > We have differenet servlets running different servlet contexts(for different virtual
domains).
> > We need to have a management servlet that can communicate with all these servlets
> >
>
> What you can do is use the java.net.URLConnection class (or it's subclass,
> java.net.HttpURLConnection) to make a request from one servlet to another, and then process
the
> response.  The details are in the JDK javadocs for these classes.  There are also examples
of
> using them in the Java Language Tutorial's networking trail
> <http://java.sun.com/docs/books/tutorial>.
>
> Craig McClanahan
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org


Mime
View raw message