[weld-dev] @Inject FacesContext

Gavin King gavin.king at gmail.com
Tue Nov 10 17:14:08 EST 2009


The thing is that I don't love the idea of accessing the FacesContext
directly. It's too big, with too many implementation details.

I prefer to inject something that abstracts it. Like the Seam Messages object.

On Tue, Nov 10, 2009 at 5:05 PM, Dan Allen <dan.j.allen at gmail.com> wrote:
> That just seems to me like the opposite of what we are trying to achieve
> with injection.
>
> I would argue against HttpSession and request (I'm assuming ServletRequest)
> because that is the point of FacesContext...to abstract that away somewhat.
> But you still need FacesContext.
>
> -Dan
>
> On Tue, Nov 10, 2009 at 4:51 PM, Gavin King <gavin.king at gmail.com> wrote:
>>
>> Call FacesContext.setCurrentInstance() :-)
>>
>> On Tue, Nov 10, 2009 at 4:29 PM, Steven Boscarine
>> <steven.boscarine at childrens.harvard.edu> wrote:
>> >
>> > Gavin King wrote:
>> >>
>> >> I didn't put it in, since I figured it was hard to justify that this
>> >> is better than FacesContext.getCurrentInstance().
>> >>
>> >
>> > How would one unit test a class that has such a call?
>> >
>> >
>> >
>>
>>
>>
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>
>
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://www.google.com/profiles/dan.j.allen
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org


More information about the weld-dev mailing list