users@jersey.java.net

[Jersey] Re: XML data vaidation with JAXB

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 12 Jul 2011 23:56:37 +0200

you should be able to do it via injected instance of ProviderServices:

@Provider
public class MyUnmarshallerResolver implements
ContextResolver<Unmarshaller> {
     public MyUnmarshallerResolver(@Context ProviderServices
providerServices) {
         providersServices.getProvidersAndServices..

     }
     ...
}

let me know whether it helped - if not, I should be able to create
better sample.

Regards,
Pavel



On 7/12/11 8:00 PM, John G. Lussmyer wrote:
> Thank you, that does help.
> I also found that we already have an @Provider for our JAXBContext -
> which brings up the question, is there a standard way for me to get
> the JAXBContext created by that @Provider to use in my Unmarshaller
> @Provider?
>
> On 7/12/2011 7:58 AM, Pavel Bucek wrote:
>> Hello,
>>
>> you can set your own Unmarshaller instance by implementing
>> ContextResolver<Unmarshaller>:
>>
>> @Provider
>> public class MyUnmarshallerResolver implements
>> ContextResolver<Unmarshaller> {
>> ...
>> }
>>
>> See:
>> http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/ContextResolver.html
>>
>> Regards,
>> Pavel
>>
>> On 7/12/11 4:42 PM, cougar_at_casadelgato.com wrote:
>>> We are using jersey with jaxb generated classes.
>>> We'd like to enable input data validation, but I've been unable to
>>> figure out just how to do this.
>>> Is there a tutorial somewhere for this?
>>>
>>> It looks like I'll need to generate a schema from the xsd file, but all
>>> the instructions for using it involve setting up an unmarshaller -
>>> which jersey seems to do internally, so I don't have access to it.
>>>
>>
>>
>
>