tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris.Christo" <chris.chri...@mail.com>
Subject Re: Set custom ValidationEventHandler for jaxb and jax-rs
Date Tue, 18 Jun 2013 16:53:04 GMT
Ok so extended the class and added this new class to the providers list (cxf.jaxrs.providers)
however, when unmarshalling, it still uses the original JAXBElementProvider and not my CustomJAXBElementProvider
class to do the work. Its like both are now in memory as providers but the original JAXBElementProvider
gets chosen to do the work.

Chris,

@ChriChristo7 
{ twitter.com/ChrisChristo7 }
{ ChrisChristo7.tumblr.com }

LinkedIn { linkedin.com/in/ChrisChristo }
Angel { angel.co/chris-christo }
GitHub { github.com/ChrisChristo }

On 18 Jun 2013, at 16:30, "Chris.Christo" <chris.christo@mail.com> wrote:

> yes, it just clicked what you meant (just before your mail arrive :D ), will give it
a shot.
> 
> Chris,
> 
> @ChriChristo7 
> { twitter.com/ChrisChristo7 }
> { ChrisChristo7.tumblr.com }
> 
> LinkedIn { linkedin.com/in/ChrisChristo }
> Angel { angel.co/chris-christo }
> GitHub { github.com/ChrisChristo }
> 
> On 18 Jun 2013, at 16:25, Romain Manni-Bucau <rmannibucau@gmail.com> wrote:
> 
>> Just inherit from cxf class then init it as you want.
>> 
>> Then configure in cxf.jaxrs.providers your own class
>> 
>> *Romain Manni-Bucau*
>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> *Github: https://github.com/rmannibucau*
>> 
>> 
>> 
>> 2013/6/18 Chris.Christo <chris.christo@mail.com>
>> 
>>> Ok thanks for the help, just a little unsure what you mean? Can you
>>> elaborate please? or show me a couple of lines of code :D
>>> 
>>> Chris,
>>> 
>>> @ChriChristo7
>>> { twitter.com/ChrisChristo7 }
>>> { ChrisChristo7.tumblr.com }
>>> 
>>> LinkedIn { linkedin.com/in/ChrisChristo }
>>> Angel { angel.co/chris-christo }
>>> GitHub { github.com/ChrisChristo }
>>> 
>>> On 18 Jun 2013, at 16:12, Romain Manni-Bucau <rmannibucau@gmail.com>
>>> wrote:
>>> 
>>>> Hmm, i missed the fact the attribute was an object. I think it doesn't
>>> work
>>>> ATM. The faster and easier will be to wrap it in a custom bean then
>>> simply
>>>> configure your provider to be used (+ your configuration doesn't becomes
>>> as
>>>> complicated as your code this way).
>>>> 
>>>> *Romain Manni-Bucau*
>>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>> *Blog: **http://rmannibucau.wordpress.com/*<
>>> http://rmannibucau.wordpress.com/>
>>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>> *Github: https://github.com/rmannibucau*
>>>> 
>>>> 
>>>> 
>>>> 2013/6/18 Chris.Christo <chris.christo@mail.com>
>>>> 
>>>>> Yeah I'm trying to do that via system.properties (same thing I guess).
>>>>> 
>>>>> But a bit unsure how you set an object as a property? So I tried to
>>> define
>>>>> my CustomValidationHandler class as a service as well and then just set
>>> the
>>>>> eventHandler property of the JAXBElementProvider to the the handler,
>>>>> something like:
>>>>> 
>>>>> 
>>>>> 
>>> customValidationHandler=new://Service?class-name=example.CustomValdationHandler
>>>>> 
>>>>> 
>>>>> 
>>> jaxb_element_provider=new://Service?class-name=org.apache.cxf.jaxrs.provider.JAXBElementProvider
>>>>> jaxb_element_provider.eventHandler=customValidationHandler
>>>>> 
>>>>> cxf.jaxrs.providers = jaxb_element_provider
>>>>> 
>>>>> 
>>>>> Chris,
>>>>> 
>>>>> @ChriChristo7
>>>>> { twitter.com/ChrisChristo7 }
>>>>> { ChrisChristo7.tumblr.com }
>>>>> 
>>>>> LinkedIn { linkedin.com/in/ChrisChristo }
>>>>> Angel { angel.co/chris-christo }
>>>>> GitHub { github.com/ChrisChristo }
>>>>> 
>>>>> On 18 Jun 2013, at 15:48, Romain Manni-Bucau <rmannibucau@gmail.com>
>>>>> wrote:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> you can define the JAXBElementProvider in resources.xml then configure
>>>>> its
>>>>>> attribute through the properties of the <Service/> block. Then
simply
>>>>>> reference it through the id in cxf.jaxrs.providers list.
>>>>>> 
>>>>>> Romain Manni-Bucau
>>>>>> Twitter: @rmannibucau
>>>>>> Blog: http://rmannibucau.wordpress.com/
>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>>>> Github: https://github.com/rmannibucau
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 2013/6/18 Chris.Christo <chris.christo@mail.com>
>>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> Trying to configure tomee to register my custom ValidationEventHandler
>>>>>> for the unmarshaller of jaxb when my rest points are hit, but not
sure
>>>>>> where to set this.
>>>>>>> 
>>>>>>> I found something here,
>>>>>> http://osdir.com/ml/users-cxf-apache/2011-03/msg00525.html, in that
>>> I'm
>>>>>> supposed to set
>>>>>> org.apache.cxf.jaxrs.provider.JAXBElementProvider.validationHandler
to
>>> my
>>>>>> custom class.
>>>>>>> 
>>>>>>> I did also try adding the class name to cxf.jaxrs.providers (something
>>>>>> like cxf.jaxrs.providers = example.CustomValidationHandler) but didn't
>>>>> work.
>>>>>>> 
>>>>>>> Any pointers?
>>>>>>> 
>>>>>>> 
>>>>>>> Chris,
>>>>>>> 
>>>>>>> @ChriChristo7
>>>>>>> { twitter.com/ChrisChristo7 }
>>>>>>> { ChrisChristo7.tumblr.com }
>>>>>>> 
>>>>>>> LinkedIn { linkedin.com/in/ChrisChristo }
>>>>>>> Angel { angel.co/chris-christo }
>>>>>>> GitHub { github.com/ChrisChristo }
>>>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message