You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by "Ali, Haneef" <ha...@hp.com> on 2010/11/22 23:48:59 UTC
JAXB Schema validation
Hi ,
I do have couple of questions.
1) How to do schema validation while using JAXB with WINK? My resource method accepts a JAXBElement which is generated from a schema. Wink runtime seems to be accepting and marshalling it to JAXBElement even if the element doesn't have some required element.
a. Is there any other way to do the validation other than declaring the resource method to take a string parameter and doing the marshalling/unmarshalling manually.
2) In the wink examples folder under core/jaxb, what is the use of JAXBContext resolver and why don't we have contex resolver for "Phone.class"
Thanks,
Haneef
Re: JAXB Schema validation
Posted by Mike Rheinheimer <ro...@apache.org>.
Hi Haneef,
1) Currently there is no schema validation. Although you've pointed
out that it might be desirable to do so. Can you open a Jira for this
so we can explore it?
a. That's the only way to do it, currently.
2) Wink has a default context resolver that configures the JAXB
context to include only the class currently being marshalled. If the
JAXB object hierarchy is significantly more complex than this, it may
be necessary to construct your own JAXB context by way of implementing
a custom ContextResolver. The Javadoc in JaxbResource has an
explanation. Those resolvers for Person and Address do the very same
thing the default Wink context resolver does for Phone. It's an
example of what you *could* do, not necessarily what you *should* do.
:)
mike
On Mon, Nov 22, 2010 at 4:48 PM, Ali, Haneef <ha...@hp.com> wrote:
> Hi ,
>
>
>
> I do have couple of questions.
>
>
>
> 1) How to do schema validation while using JAXB with WINK? My
> resource method accepts a JAXBElement which is generated from a schema.
> Wink runtime seems to be accepting and marshalling it to JAXBElement even if
> the element doesn’t have some required element.
>
> a. Is there any other way to do the validation other than declaring
> the resource method to take a string parameter and doing the
> marshalling/unmarshalling manually.
>
>
>
>
>
> 2) In the wink examples folder under core/jaxb, what is the use of
> JAXBContext resolver and why don’t we have contex resolver for “Phone.class”
>
>
>
>
>
> Thanks,
>
> Haneef