You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by simon <sk...@apache.org> on 2007/08/18 12:54:09 UTC

[orchestra] FrameworkAdapter

Hi,

The FrameworkAdapter class currently uses a static variable to find its
singleton object. However static variables are tricky in unit testing,
and are a problem when a library is deployed via a shared classloader.

However the whole point of the FrameworkAdapter is that it is accessable
from anywhere, and is not JSF-specific which makes finding an
alternative implementation a little tricky.

The only thing which comes to mind is using a ThreadLocal, and having a
servlet request filter that sets up the threadlocal on request start and
resets it on request end. This is effectively how
FacesContext.getCurrentInstance works.

Do we care about FrameworkAdapter's use of a static, and if so does
anyone have any other suggestions?

Regards,

Simon


Re: [orchestra] FrameworkAdapter

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> The FrameworkAdapter class currently uses a static variable to find its
> singleton object. However static variables are tricky in unit testing,
> and are a problem when a library is deployed via a shared classloader.
>
> The only thing which comes to mind is using a ThreadLocal, and having a
> servlet request filter that sets up the threadlocal on request start and
> resets it on request end. This is effectively how
> FacesContext.getCurrentInstance works.
>   
I see no problem in doing so, just add it to the OrchestraServletFilter.

Ciao,
Mario