I'm not sure i understand.  So, you want the tool to be
request-scoped, but have the instance (or things it creates) live for
the length of the application?  If that's it, then i don't think
ThreadLocal will help.   Or is it simply that you expect there to be a
lot of instances of *the tool* created for every request and wish to
share things between those instances.  If that's it, then why not just
store them as request attributes?  I'm not sure i see why ThreadLocal
is needed, though yeah, that should work too.  I'm also not sure why
you expect there to be a lot of instances of your tool created for
every request.  Have you seen this happening?  The tool management
code for Tools 2.0 stores the request-scoped tools in the request to
allow them to be shared.  The intention is that request scoped tools
would only need to be created once per-request, even when request
includes and forwards are involved.  I'll admit i haven't tested that
carefully though, so i'd like to know if i've misunderstood how
RequestDispatcher handles request attributes for forwards and
includes.

On Wed, Feb 25, 2009 at 3:28 AM, Antonio Petrelli
<[email protected]> wrote:
> Hi all
> I need to create a tool that is based on HTTP requests for Tiles 2. I
> succesfully did it through extending "ImportSupport" class, so I can
> access the request protected field.
> However, I don't feel comfortable with this solution, because this
> tool needs to be request-scoped and I need to create, at every
> request, a lot of objects that are potentially reusable.
> Is there a way to make this tool application-wide? Or is there a way
> (a repository?) to access a registered application-wide object,
> instead of creating it over and over?
>
> Thanks a lot in advance
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to