You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Naga Yerramsetti <na...@tems.com> on 2000/06/08 20:20:15 UTC
Servlet Collaboration
Is it possible for a servlet to access servlet from another 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
Re: Servlet Collaboration
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
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