jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [527-InjectFacesContext] Support and review

From: manfred riem <manfred.riem_at_oracle.com>
Date: Wed, 24 Sep 2014 15:20:54 -0500

Hi Arjan,

On 9/24/14, 11:29 AM, Arjan Tijms wrote:
> Hi,
>
> On Wed, Sep 24, 2014 at 4:12 PM, manfred riem<manfred.riem_at_oracle.com> wrote:
>> As part of ramping up for the JSF 2.3 spec cycle I went ahead and prototyped
>> @Inject support for the FacesContext and it works, but as I want to be fair
>> to the spec process I am asking you if we should support this?
> Definitely support this. Having important artefacts injectable
> certainly plays well with the theme of aligning with CDI.
>
> One issue though is that injection now only works in request scoped
> beans, since FacesContext is not normal scoped itself. While
> understandable from a technical point of view, I wonder whether or not
> it's possible to inject a bean instead so CDI will use a proxy and
> injection can be safely done in any type of bean.
I thought about that as well, but since the other bean types can live
longer than a request what does it mean to have a reference to a
FacesContext? Or phrased a bit differently what would a FacesContext be
used for outside the scope of a request? If the issue is that you want
to get to something that is part of the FacesContext I would like to
understand what that is.

>
> Looking at some other work, the CDI 1.1 spec allows one to inject an
> HttpServletRequest, but it's also dependent scoped. Seam 3 however
> allowed injection of a ServletRequest as a request scoped bean, which
> could therefore be safely injected everywhere.

So how did Seam solve the above problem?

Kind regards,
Manfred