users@javaserverfaces-spec-public.java.net

[jsr372-experts mirror] [jsr372-experts] Re: why PushContext cannot be obtained from FacesContext?

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Thu, 1 Sep 2016 23:47:29 +0200

Hi,

On Thu, Sep 1, 2016 at 5:59 AM, Leonardo Uribe <leonardo.uribe_at_irian.at>
wrote:

> My reasoning is in JSF there is always a way to do certain things
> programmatically.
>

This often can be done with the CDI APIs just as well. The entry point is
CDI.current().select(SomeBean.class, ...);

Basically, if it can be injected it can typically be obtained that way.


> For example Application.evaluateExpressionGet(...) to get beans using EL,
> but some new features seem to work only with CDI or maybe rely too much on
> it.
>

Some features indeed work with CDI only, but the Java EE platform and JSF
among it has been moving towards that already in EE 7. @FlowScoped is a CDI
only feature as well, as is @Transactional in JTA. MVC and the Security API
are fully CDI based to begin with.



> The annotation syntax using @Inject and @Push is nice, but I'm suspicious
> about why PushContext extends Serializable. I don't understand why extends
> from this interface, or if this is necessary.
>

In order to inject into a beans with a passivating scope, the injection
target has to Serializable.

Kind regards,
Arjan Tijms



>
> regards,
>
> Leonardo Uribe
>