cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomstark <tom.st...@polycom.com>
Subject Re: how to specify default namespace in JSON
Date Thu, 06 Jun 2013 19:31:45 GMT
Hi Sergey,

Thanks for the quick response.

I neglected to mention that I was already setting the ignoreNamespaces
property to true.  I was hoping that worked on input and output.  Looks like
it only works on input.  Is that true?

I see that I'm getting Jettison 1.3.1 so I'll grab 1.3.3 and try that too.

In regards to the input transforms, correct me if I misinterpreted the way
that works -- I would have to add a transform line for each element in all
objects to properly prepend the correct namespace (this would also assume
that all  elements were uniquely named).  This might be pretty voluminous
and not easy to maintain.  Is there a better way or am I missing something?

What would be nice is to recognize the input class (like User.class) and
then prepend the correct namespace for elements in that class that don't
have an annotation declaring a different namespace.  The annotations are in
the JAXB generated source.  This is what I need but I don't see a way to do
this easily. 

For example:
@XmlRootElement(name = "user")
public class User implements ETag, Equals, HashCode, ToString {
    @XmlElement(name = "user-role", namespace =
"urn:com:company:api:rest:user-role")
    protected UserRole userRole;
    @XmlElement(required = true)
    protected String username;
}

Perhaps the problem is that the @XmlRootElement doesn't have its namespace
defined?  Perhaps there is a setting in the jaxb2 plugin that would emit
this for me?

Thoughts?




--
View this message in context: http://cxf.547215.n5.nabble.com/how-to-specify-default-namespace-in-JSON-tp5728855p5728876.html
Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message