Johnny, Indeed. I only yesterday discovered the crossContext flag and the getServletContext(String) call in the API, however my reading tells me that most servlet containers don't support it, being that they simply return null. For Tomcat you can specify the crossContext flag for that not to happen, but it is unique to Tomcat (I think?).
Regardless, since I am in full control of the container, and both the webapps, it is an option I'm considering. I don't like to go with 'hacks', preferring to stick to standard solutions to problems being that experience has taught me that the hacks come back to bite you in the long run, but in this case, I might make an exception. - Darryl ----- Original Message ---- From: Johnny Kewl <[EMAIL PROTECTED]> To: Tomcat Users List <users@tomcat.apache.org> Sent: Thursday, October 9, 2008 1:57:28 AM Subject: Re: Communicating between webapps ----- Original Message ----- From: "Darryl Pentz" <[EMAIL PROTECTED]> To: "Tomcat Users List" <users@tomcat.apache.org> Sent: Wednesday, October 08, 2008 10:02 PM Subject: Re: Communicating between webapps > Bill, > > You would think so but it isn't that easy. Which is good to some degree, > because that would seem like a scary security vulnerability. Nevertheless, > besides that, Tomcats classloader hierarchy also prevents this mechanism. > > It would be useful if there was some form of publish-subscribe message bus > that one could, well, publish or subscribe to. I realize that JMS falls > into this category, but JMS is overkill to what I'm referring to. > > I recall using a message bus type of approach in a Swing application many > moons ago. Forget the name of the library now. Had 'bus' in its name, > perhaps somebody here knows. > > Anyway, from the responses one can tell this isn't an easy peasy no > brainer. *shrug* > > ----- Original Message ---- > From: Bill Davidson <[EMAIL PROTECTED]> > > Since you're running in the same JVM, I'm not sure why you > can't set up some sort of observer-subject scheme (kind of > like ActionListener if you're familiar with that) so that the apps > can just access each other's object directly. You can set up a > singleton object to register the observers between webapps. > Just be sure to synchronize properly. What Bill is suggesting is not that difficult... but then its probably because we thinking outside of your framework... Have you looked at this sort of stuff... ServletContext ctx = getServletContext().getContext("/someOtherContext"); RequestDispatcher rd = ctx.getNamedDispatcher("servlet-name"); rd.forward(request, response); Cookies dont go with it... but you can play with attributes ServletContext myContext = getServletContext(); String url = "/someWebAppPrefix"; ServletContext otherContext = myContext.getContext(url); Object someData = otherContext.getAttribute("someKey"); This is just stuff I grabbed... not flowing code that I've tried... but in kinda sounds like you want to forward across webapps?? Req into A... do some stuff.... set some data.... tell some servlet in webapp B to process it and return the response... ? ... maybe... If you really get writers block... or it starts getting really ugly... normally means the architecture is screwed somewhere... Do they have to be separate webapps... etc? ... good luck... --------------------------------------------------------------------------- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --------------------------------------------------------------------------- If you cant pay in gold... get lost... --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]