|
Replies:
2
-
Last Post:
Nov 11, 2008 3:19 PM
by: techiesaf
|
|
|
|
|
|
|
How to retrieve inputstream from StaxSource when using Provider API
Posted:
Nov 10, 2008 12:16 PM
|
|
|
Hi, I need to do stream large messages that will be passed from the client to the server side - so decided to go with the provider API. However on the server side we receive a StaxSource object - and it is not possible to retrieve a stream from that object. I had to do the following in my code - but it doesnt seem like the right solution since i do not want to write out all the binary data in memory in the ByteOutputStream... Does Metro provide some way of going about it - since the whole purpose of Provider API is to enable us to handle large messages --
ByteArrayOutputStream bos = new ByteArrayOutputStream(); StreamResult streamResult = new StreamResult(bos); Transformer trans = TransformerFactory.newInstance().newTransformer(); trans.transform(inSource, streamResult); bos.close(); ByteArrayInputStream in = new ByteArrayInputStream(bos.toByteArray());
thanks.
|
|
|
|
|
|
|
Re: How to retrieve inputstream from StaxSource when using Provider API
Posted:
Nov 11, 2008 4:28 AM
in response to: techiesaf
|
|
|
On 10. Nov 2008, at 22:16, metro@javadesktop.org wrote:
> I need to do stream large messages that will be passed from the > client to the server side - so decided to go with the provider API. > However on the server side we receive a StaxSource object - and it > is not possible to retrieve a stream from that object. I had to do > the following in my code - but it doesnt seem like the right > solution since i do not want to write out all the binary data in > memory in the ByteOutputStream... Does Metro provide some way of > going about it - since the whole purpose of Provider API is to > enable us to handle large messages -- > > ByteArrayOutputStream bos = new ByteArrayOutputStream(); > StreamResult streamResult = new StreamResult(bos); > Transformer trans = > TransformerFactory.newInstance().newTransformer(); > trans.transform(inSource, streamResult); > bos.close(); > ByteArrayInputStream in = new > ByteArrayInputStream(bos.toByteArray());
Are you aware of this: https://metro.dev.java.net/guide/Large_Attachments.html
Fabian
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net For additional commands, e-mail: users-help@metro.dev.java.net
|
|
|
|
|
|
|
|
Re: How to retrieve inputstream from StaxSource when using Provider API
Posted:
Nov 11, 2008 3:19 PM
in response to: Fabian Ritzmann
|
|
|
Hi Fabian, Thanks, I will look into Mtoms to see if that will resolve my issue. SA
|
|
|
|
|