You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Samuli Elomaa <sa...@pp.inet.fi> on 2006/05/03 09:56:39 UTC

Servlet inter-communication

Hi,
Is there any otherway for two servlets in same tomcat to communicate  
together except by http requests? Eg. could two servlets use somekind  
of shared memory? or send signals to each other?

Samuli

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet inter-communication

Posted by Michael Echerer <me...@tngtech.com>.
Samuli Elomaa wrote:
> Hi,
> Is there any otherway for two servlets in same tomcat to communicate 
> together except by http requests? Eg. could two servlets use somekind 
> of shared memory? or send signals to each other?

Hi,

whatever others suggested, just use the Servlet Spec 2.3+ standard:

The webapp context scoped shared memory is here:

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#setAttribute(java.lang.String,%20java.lang.Object)
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getAttribute(java.lang.String)

The event listener is here:

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContextAttributeListener.html

Singletons are evil, even more devilish for webapps. ;-)

Cheers,
Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org