Hi Mark,
Can you share the JAXB context resolver code? just so i can understand
how you are configuring the JAXBContext.
Without the application informing Jersey on what the JAXBContext is
for a set of JAXB classes it defaults to doing:
Class type = ...
JAXBContext c = JAXBContext.newInstance(type)
I am not sure how one should derive a package name where an
ObjectFactory.class and/or jaxb.index file is present, so i am unsure
if this can be achieved without some form of configuration supplied by
the developer.
Perhaps given a Class one could check if ObjectFactory.class and/or
jaxb.index is present in the same package and if so create a
JAXBContext given the package name of the Class?
Perhaps another way is to scan for all ObjectFactory.class and/or
jaxb.index?
Jakub, IIRC you have received similar feedback in this respect but
relating to JSON configuration?
Paul.
[1]
http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html#newInstance%28java.lang.String,%20java.lang.ClassLoader%29
On Dec 4, 2009, at 4:13 AM, Mark Petrovic wrote:
> Good day.
>
> I had a run-in today with a Jersey client that produced no namespace
> attribute in the XML serialized from a JAXB object. Turns out you
> can fix this by providing a JAXB context resolver to the
> ClientConfig for that Jersey client, where such a context resolver
> knows about the namespace of the serialized objects.
>
> All this leaves me wondering how to build the namespace into the
> JAXB objects themselves so an overlooked ClientConfig context
> resolver does not produce what turns out to be under-formed XML.
> The maven plugin we're using for the XSD -> JAXB class generation
> produces the usual target/generated-sources folder, with a package-
> info.java file that contains the namespace spec. I don't know how
> this file is used, or by what. But since it exists I assume there
> might be a way to have the essence of its contents integrated into
> the JAXB classes themselves, making those classes aware of their
> namespace.
>
> Hope this makes sense. Is there a way to make the JAXB classes
> aware of their namespace so the Jersey client doesn't need a special
> JAXB context resolver?
>
> thx
> Mark
>
> --
> Mark Petrovic
> mark_at_petrovic.org
> http://www.petrovic.org
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>