lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: Servlets Sharing Resources
Date Tue, 21 Apr 2009 20:10:09 GMT
Various servlets or various webapps?
Various servlets is trivial, indeed using ServletContext.getAttribute().
Various webapps is more difficult:
- you need to set cross context so that context.getContext("/ 
otherpath") is accessible (a config of context in tomcat)
- you need classes to be shared (put jars in lib in tomcat)

Instead of context.getAttribute() you can always use statics....


Le 21-avr.-09 à 20:29, David Seltzer a écrit :

> I'm going to try storing a persistent manager class in the
> ServletContext so I can access it from the various servlets. It's  
> not a
> 100% solution, but I think it'll strike the right balance between
> madness and a series of increasingly annoying if-statements. :-)
> Unless there's a reason that's a bad idea... The only thing I can  
> think
> of is that I need to make sure that one servlet is responsible for
> setting it up and disposing of it.

View raw message