tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward W. Rouse" <ero...@vei.net>
Subject Re: Servlet Collaboration
Date Mon, 12 Jun 2000 17:15:46 GMT
use RMI or an ORB.
ed.

James Cook wrote:

> Naga,
>
> You cannot pass objects between servlet contexts. There may be a kludgey way
> for you to attempt this, such as a shared file or shared memory, but it is
> highly non-portable. You may also be able to serialize the object as a
> string from one context to the other, but it would have to take place as a
> normal HTTP call.
>
> jim
>
> ----- Original Message -----
> From: Naga Yerramsetti <naga@tems.com>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Monday, June 12, 2000 12:27 PM
> Subject: Re: Servlet Collaboration
>
> > 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
> >
> >
> > --------------------------------------------------------------------------
> > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
> >
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org


Mime
View raw message