cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <sbery...@progress.com>
Subject RE: Handling Collection<JAXBElement> returns via JAX-RS
Date Fri, 07 Aug 2009 07:28:28 GMT
Hi Gabo

Yeah, I agree, in some cases names like 'Historys' do no look right :-) but it can be tricky
to come with the universally acceptable collection name, as CXF supports now explicit arrays,
lists, base collections and sets. 
One can override it by setting a global 'collectionWrapperName' or 'collectionWrapperMap'
property on
a JAXBElementProvider bean. 'collectionWrapperMap' is a map property, keys are collectionWrapperNames
and values are class names, or ex, if a given service returns History and Datum then one would
use this property.

CollectionWrapperName can be a simple name like 'ListOfHistory' or an expanded QName like
'{http://history}ListOfHistory'. In the latter case a 'ns1' prefix will be bound to an {http://history}
namespace. 

By the way, I've been working on updating the JAX-RS docs for the last 2 days, so it's all
documented now :

http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Handlingexplicitcollections

but I'm going to spend more time on improving the docs.

thanks, Sergey

-----Original Message-----
From: Gabo Manuel [mailto:kmanuel@solegysystems.com]
Sent: Fri 8/7/2009 1:28 AM
To: users@cxf.apache.org
Subject: Re: Handling Collection<JAXBElement> returns via JAX-RS
 
Hi Sergey,

> By default, pluralized XMLRootElement name attribute will be used as a
> wrapper, namespace-prefixed if needed, if no name attribute is there then a
> lower-case pluralized class name will be used. 
Just tested the latest release 2.2.3. The rest services handle the 
collections. Just a comment though, I think it would be better to use 
'ArrayOf_<XMLRootElement name attribute>'. It just looks weird to have a 
tag like 'Historys' or 'Datums' (along with other words that have 
special case of plurality) or maybe adding an attribute to the 
annotation to specify the plural term to be used.

Gabo



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message