myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: How to make CODI BV module work
Date Sat, 15 Sep 2012 09:01:23 GMT
short addition @validator-factory:

for sure you can use it as well, but not directly as default implementation.
(you would have to create a small adapter for it which resolves the
@Advanced validator-factory -> delegate to it).

regards,
gerhard



http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2012/9/15 Gerhard Petracek <gerhard.petracek@gmail.com>

> hi yaocl,
>
> you also have to inject and use an @Advanced javax.validation.Validator.
> please have a look at [1].
>
> regards,
> gerhard
>
> [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
>
> 2012/9/14 YaoCL <chunlinyao@gmail.com>
>
>> Hi
>>
>> I think the JSF and JPA must use InjectableValidatorFactory to support
>> CDIAwareValidator.
>> But put the CODI jars into WEB-INF/lib not make the JSF and JPA use
>> InjectableValidatorFactory,
>> They still use ApacheValidatorFactory.
>>
>> If I @Inject ValidatorFactory into ManageBean I can get
>> InjectableValidatorFactory
>>
>> @Named
>> @RequestScope
>> public class PageController {
>>         @Inject
>>         @Advanced
>>         ValidatorFactory validatorFactory;
>>
>> }
>>
>> How to replace the default ValidatorFactory?
>>
>> Regards
>> YaoCL
>>
>> 在 2012-9-14,下午4:26,Yaocl <chunlinyao@gmail.com> 写道:
>>
>> > Hi
>> >
>> > I have @Advanced on my validator. Is there extra config required for
>> CODI?
>> > I only copied the jars into WEB-INF/lib folder.
>> >
>> >
>> > @ApplicationScoped
>> > @Advanced
>> > public class NameUniqueValidator implements
>> >               ConstraintValidator<NameUnique, String>, Serializable {
>> >
>> >       /**
>> >        *
>> >        */
>> >       private static final long serialVersionUID = 1L;
>> >       @Inject
>> >       private UserService service;
>> >
>> >       @Override
>> >       public void initialize(NameUnique arg0) {
>> >       }
>> >
>> >       @Override
>> >       public boolean isValid(String name, ConstraintValidatorContext
>> context) {
>> >               return service.isNameValid(name);
>> >       }
>> > }
>> >
>> > Regards,
>> > YaoCL
>> >
>> > On Fri, Sep 14, 2012 at 4:18 PM, Thomas Andraschko <zoigln@gmail.com>
>> wrote:
>> >> Hi,
>> >>
>> >> did you try @Advanced on your validator?
>> >> This is required if you did not deactivate it via config.
>> >>
>> >> Regards,
>> >> Thomas
>> >>
>> >>
>> >> 2012/9/14 Yaocl <chunlinyao@gmail.com>
>> >>>
>> >>> Hi
>> >>>
>> >>> I can't figure out how to make CODI Bean Validation modules work. I
>> >>> have a custom constraint require query db.
>> >>> I have put all CODI jar files in my WEB-INF/lib folder. But @Inject
>> >>> not work in my custom validator.
>> >>>
>> >>> My java server is TomEE+ 1.1 snapshot. I tried to debug it, Both JSF
>> >>> and JPA using default Validator Factory.
>> >>>
>> >>> Can someone give me a example of using CODI BV module?
>> >>>
>> >>>
>> >>> --
>> >>> YaoCL
>> >>
>> >>
>>
>>
>

Mime
View raw message