On Wed June 24 2009 12:05:46 pm Andrew Clegg wrote:
> 2009/6/24 Daniel Kulp <[email protected]>:
> > If the Provider is marked just "Source" or "DOMSource", then it parses
> > into a DOM and returns a DOMSource.   This allows you to work with the
> > DOM without reparsing.   However, that's probably more memory intensive.
>
> The Provider<Source> is new in 2.2 right? This actually allowed me to
> simplify some of my code, for a service that requires parsed input but
> can produce streamed output very quickly. Thanks :-)

Just an FYI:  another reason for using DOMSource by default for "Source" is 
that it works VERY well with ws-security stuff and/or JAX-WS Handlers.   Since 
both of those cases already require a DOM/SAAJ model, we can just use the DOM 
element that they already have parsed.   Basically becomes a no-op.    That's 
an optimization added for 2.2.2.

> > One thing I keep meaning to try getting to work is to allow
> > Provider<XMLStreamReader> to get the raw XMLStreamReader that we use.
> >  That would provide the best performing and best memory usage scenario.  
> > It's just not working yet.
>
> That would be awesome. What are the major stumbling blocks? I'm
> tempted to have a go myself, although if it's giving you serious
> trouble, I'm not sure how much help I could be...

The MAJOR stumbling block are all the subclasses of 
AbstractInDatabindingInterceptor.  Basically, after they call the 
"datareader.read(...)" stuff, they advance the XMLStreamReader to the next 
element (or end element) to see if there is "more stuff" that needs to be read 
and then throw an exception if too much stuff is there.    It basically 
assumes the databinding has "consumed" the data for the current element so it 
can do that.  That won't work in this case as the databinding wouldn't have 
actually done anything with the stream.   

Thus, some flag needs to be added in to forcefully say "there is only one 
thing to read, don't do anything after it" to those interceptors.     Nothing 
major, just define the flag and look for it.  (like 
msg.getContextualProperty("read.single.part") or similar).    

Beyond that, it's just simple additions to the Readers/Writers in the "source" 
databinding.   Nothing major at all there. 


As always, a patch would be awesome!

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to