myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3797) cdi support for converters and validators
Date Mon, 07 Oct 2013 09:02:42 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13787999#comment-13787999
] 

Leonardo Uribe commented on MYFACES-3797:
-----------------------------------------

I have checked the patch and I can see the point. I think the proposed solution does not deal
with the complexity involved in the state handling. Override DeltaStateHelper or the state
handling code is not the right way to deal with state handling issues. In this case, I think
delegation pattern is the way to go. What happen if a converter/validator is marked as Serializable?
what happen if a converter/validator is StateHolder? what happen if it is PartialStateHolder?.
What happen if two different views uses the same converter on the same request? both views
will use the same?

I think it is also valid to do something like this:

@SessionScope
public class MyConverterClass implements Converter
{
   // .... some code goes here ...
}

A JSF converter or validator that is marked as a bean with a scope. It should be valid syntax,
and I feel that could be useful.

In conclusion, there are different use cases and first we need to check one by one how to
deal with them. The aim is clear: provide a clean integration between CDI and JSF.

I would like something like this:

if (cdiEnabled and this object has been injected using a cdi annotation)
{
   // ... use a cdi adapter for this stuff or something like that ...)
}
else
{
   // ... do it as usual ...
}

I need some time to think about this. First we need to solve MYFACES-3786. 

> cdi support for converters and validators
> -----------------------------------------
>
>                 Key: MYFACES-3797
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3797
>             Project: MyFaces Core
>          Issue Type: New Feature
>          Components: JSR-344
>            Reporter: Gerhard Petracek
>            Assignee: Gerhard Petracek
>         Attachments: MYFACES-3797.patch
>
>
> with
>     <context-param>
>         <param-name>org.apache.myfaces.CONVERTER_INJECTION_ENABLED</param-name>
>         <param-value>true</param-value>
>     </context-param>
> and
>     <context-param>
>         <param-name>org.apache.myfaces.VALIDATOR_INJECTION_ENABLED</param-name>
>         <param-value>true</param-value>
>     </context-param>
> it should be possible to enable cdi support for converters/validators.
> we need the config, because it was postponed for the spec.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message