lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Seltzer" <dselt...@TVEyes.com>
Subject RE: Servlets Sharing Resources
Date Tue, 21 Apr 2009 18:29:02 GMT
> But honestly, you'll just spend the next few hours googling, pulling
out
> hair, buying a book on jboss
> and then curse it, and do it this way in the end..

Spoken like a man who's been there. Hehe... Who hasn't...

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.

-Dave

-----Original Message-----
From: patrick o'leary [mailto:pjaol@pjaol.com] 
Sent: Tuesday, April 21, 2009 1:16 PM
To: java-user@lucene.apache.org
Subject: Re: Servlets Sharing Resources

Not every servlet container will support the same cross context
methodology.
Most would say you're approach is an EJB with a life cycle outside of
the
interaction layer.

But honestly, you'll just spend the next few hours googling, pulling out
hair, buying a book on jboss
and then curse it, and do it this way in the end..



On Tue, Apr 21, 2009 at 12:56 PM, David Seltzer <dseltzer@tveyes.com>
wrote:

> That certainly seems like the simple way to solve the problem. I was
> just wondering if I was overlooking a simple way to do this via
web.xml
> servlet-mapping. I was trying to avoid having everything hit the same
> doGet().
>
> -----Original Message-----
> From: patrick o'leary [mailto:pjaol@pjaol.com]
> Sent: Tuesday, April 21, 2009 12:51 PM
> To: java-user@lucene.apache.org
> Subject: Re: Servlets Sharing Resources
>
> Why not have 1 servlet and based on a parameter / url, serve 2
different
> outputs?
>
> if(request.getString("asXML") !=null)
>   showXML();
> else
>   showOtherStuff();
>
> Save yourself the hassle of dealing with jndi / contexts / spring or
> SingleTons
>
> On Tue, Apr 21, 2009 at 12:01 PM, David Seltzer <dseltzer@tveyes.com>
> wrote:
>
> > Hi All,
> >
> > Sorry for the slightly off-topic question, but I've just run into a
> gap
> > in my understanding of Servlet programming.
> >
> > The question: Is it possible for two servlets to share access to an
> > instance of IndexSearcher or an IndexReader? I'm thinking about
> setting
> > up a Search servlet to provide XML search results and a Statistics
> > servlet to provide numeric statistics based on the same data.
> >
> > I imagine the right way to do it is to make both servlets child
> classes
> > of a manager class, but I'm not sure how that would look. I'm also
not
> > sure how to configure tomcat in this scenario?
> >
> > -Dave
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message