You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Chaffee <jc...@ebates.com> on 2010/07/22 19:46:51 UTC

xsd for schema validation with jaxrs post/put

I would like the xml payload that is being posted or put into my service
to use an xsd for validation during unmarshalling.  I have several
services, but there is only one that I would like to enable this
ability. 

 

I was looking through the documentation and I wasn't able to find any
explanation of how this can be accomplished.  Any insight, would be
greatly appreciated.

 

Thanks,

 

Jason


Re: xsd for schema validation with jaxrs post/put

Posted by Sergey Beryozkin <sb...@gmail.com>.
So you have a single jaxrs:serve with multiple root resources but only would
like to validate the requests targeted at one of them ?

I can suggest the following : extend JAXBElementProvider and override its

protected Schema getSchema() method.

JAXBElementProvider has also a protected getContext() method which will give
you MessageContext from which you can get to UriInfo and check the request
URI. If request URI ends with some relative value that identifies a service
that has to be validated then delegate to the superclass, otherwise return
null.

Cheers, Sergey

On Thu, Jul 22, 2010 at 11:04 PM, Jason Chaffee <jc...@ebates.com> wrote:

> Wonder why I couldn't find that the docs when I looked.  :(
>
> I have the latter.  I have several services under a single server.
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Thursday, July 22, 2010 2:00 PM
> To: users@cxf.apache.org
> Subject: Re: xsd for schema validation with jaxrs post/put
>
> Hi
>
> If you have many jaxrs:server endpoints then you can just configure an
> individual endpoint with jaxrs:schemaLocations or by directly
> configuring an
> endpoint-specific JAXB and/or JSON provider, see
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Schemavalidation
>
> or do you have a single endpoint with multiple root resources where each
> resource is representing a service ?
>
> cheers, Sergey
>
> On Thu, Jul 22, 2010 at 6:46 PM, Jason Chaffee <jc...@ebates.com>
> wrote:
>
> > I would like the xml payload that is being posted or put into my
> service
> > to use an xsd for validation during unmarshalling.  I have several
> > services, but there is only one that I would like to enable this
> > ability.
> >
> >
> >
> > I was looking through the documentation and I wasn't able to find any
> > explanation of how this can be accomplished.  Any insight, would be
> > greatly appreciated.
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Jason
> >
> >
>

RE: xsd for schema validation with jaxrs post/put

Posted by Jason Chaffee <jc...@ebates.com>.
Wonder why I couldn't find that the docs when I looked.  :(

I have the latter.  I have several services under a single server.

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Thursday, July 22, 2010 2:00 PM
To: users@cxf.apache.org
Subject: Re: xsd for schema validation with jaxrs post/put

Hi

If you have many jaxrs:server endpoints then you can just configure an
individual endpoint with jaxrs:schemaLocations or by directly
configuring an
endpoint-specific JAXB and/or JSON provider, see
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Schemavalidation

or do you have a single endpoint with multiple root resources where each
resource is representing a service ?

cheers, Sergey

On Thu, Jul 22, 2010 at 6:46 PM, Jason Chaffee <jc...@ebates.com>
wrote:

> I would like the xml payload that is being posted or put into my
service
> to use an xsd for validation during unmarshalling.  I have several
> services, but there is only one that I would like to enable this
> ability.
>
>
>
> I was looking through the documentation and I wasn't able to find any
> explanation of how this can be accomplished.  Any insight, would be
> greatly appreciated.
>
>
>
> Thanks,
>
>
>
> Jason
>
>

Re: xsd for schema validation with jaxrs post/put

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

If you have many jaxrs:server endpoints then you can just configure an
individual endpoint with jaxrs:schemaLocations or by directly configuring an
endpoint-specific JAXB and/or JSON provider, see
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Schemavalidation

or do you have a single endpoint with multiple root resources where each
resource is representing a service ?

cheers, Sergey

On Thu, Jul 22, 2010 at 6:46 PM, Jason Chaffee <jc...@ebates.com> wrote:

> I would like the xml payload that is being posted or put into my service
> to use an xsd for validation during unmarshalling.  I have several
> services, but there is only one that I would like to enable this
> ability.
>
>
>
> I was looking through the documentation and I wasn't able to find any
> explanation of how this can be accomplished.  Any insight, would be
> greatly appreciated.
>
>
>
> Thanks,
>
>
>
> Jason
>
>