You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2009/11/02 12:54:24 UTC

A Modest proposal: a HeaderFactory?

 I was a little bit taken aback to discover that I needed to create an
entire data binding object just to get a string into a header. Is this a
common enough use case to deserve something friendlier. I definitely want to
fix up the javadoc for the two-arg overload. It takes 'Object' but only
accepts DOM elements? At least, when I passed it a string it complained that
it wanted a DOM element.

Re: A Modest proposal: a HeaderFactory?

Posted by Daniel Kulp <dk...@apache.org>.
On Mon November 2 2009 6:54:24 am Benson Margulies wrote:
>  I was a little bit taken aback to discover that I needed to create an
> entire data binding object just to get a string into a header. Is this a
> common enough use case to deserve something friendlier. I definitely want
>  to fix up the javadoc for the two-arg overload. It takes 'Object' but only
>  accepts DOM elements? At least, when I passed it a string it complained
>  that it wanted a DOM element.

There's definitely room for improvement here.    If I remember correctly, 
there were definitely thoughts about making a lot of this more friendly.   
Making the String -> DOM stuff was one.   There were basically a couple 
schools of thought:

1) For primitive type things (strings, ints, etc...), just do basic XML style 
formatting and create a DOM element and set the test.   Everything else needed 
a dom.

2) In all cases, if not a DOM, create a JAXBDataBinding and use it.  That 
would cover most of (1), but is a bit more expensive.  There is also then a 
dependency problem between rt-core and databinding-jaxb.  (minor reflection to 
solve) 

It kind of also leaves out the Aegis/XMLBeans/SDO users who then need to do 
the more complicated stuff.  

I wonder if (2) could be handled along with CXF-1983?    Basically, if the Bus 
has a "org.apache.cxf.default.databinding" property on it, defaults to 
JAXBDataBinding, use that to create the databinding object.   


-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog