You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Roger Menday <r....@fz-juelich.de> on 2006/10/31 08:46:37 UTC
XStreamSource, JavaSource and DOMSource ...
Hi,
I have a Sender and Receiver components (both extending
ComponentSupport). The sender sends a message with the Source content as
a XStreamSource. My understanding from the documentation is that the
receiver can pick up the Source content of the in message as the
original XStream pojo (avoiding the extra marshalling). However, in the
case of a different receiver, not aware that the source is a JavaSource,
it can use the DOM representation of the content. However, from all my
experiments, the content of the Source of the incoming message at the
receiver is always DOMSource, and I can't get hold of the original POJO ...
Can anyone point out where I'm going wrong. I've looked through the
testcases for something to help me out, but can't find something doing
this exactly.
Thanks,
Roger
Re: XStreamSource, JavaSource and DOMSource ...
Posted by Roger Menday <r....@fz-juelich.de>.
Hi Guillaume,
Thanks for your feedback.
The preserveContent property seems to do the trick ! Thanks.
i.e. i can get my POJO and it's also available as a regular DOM source.
which (i guess means) that it's not using CopyTransformer behind the
scenes for my test setup. (?)
Thanks,
Roger
> The content of the message itself is changed when the xml
> needs to be read for logging or serialized. This is necessary
> so that if you put a source based on a stream, you won't have
> a EOF exception when the component processes the message.
> So the Source are transformed to DOMSource, which can be
> re-read at will.
>
> On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
>> Hi Guillaume,
>> > The main cause would be that the exchange is logged at DEBUG
>> > level. This means that the xml is displayed, and thus the Source
>> > is transformed to a DOMSource. You can avoid that by changing
>> > the log level to INFO, or by setting the system property
>> > "org.apache.servicemix.preserveContent" to "true".
>> I was examining the Source content by actually getting the content, and
>> looking at the class of the Source object ... (?)
>>
>> Roger
>> >
>> > It seems also that the CopyTransformer do not recognize the
>> > XStreamSource as a re-readable Source.
>> > It means that if the message is transformed by the CopyTransformer,
>> > it will be transformed to a DOM Source.
>> >
>> > On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I have a Sender and Receiver components (both extending
>> >> ComponentSupport). The sender sends a message with the Source
>> content as
>> >> a XStreamSource. My understanding from the documentation is that the
>> >> receiver can pick up the Source content of the in message as the
>> >> original XStream pojo (avoiding the extra marshalling). However,
>> in the
>> >> case of a different receiver, not aware that the source is a
>> JavaSource,
>> >> it can use the DOM representation of the content. However, from
>> all my
>> >> experiments, the content of the Source of the incoming message at the
>> >> receiver is always DOMSource, and I can't get hold of the original
>> >> POJO ...
>> >>
>> >> Can anyone point out where I'm going wrong. I've looked through the
>> >> testcases for something to help me out, but can't find something
>> doing
>> >> this exactly.
>> >>
>> >> Thanks,
>> >>
>> >> Roger
>> >>
>> >>
>> >
>> >
>>
>>
>>
>
>
Re: XStreamSource, JavaSource and DOMSource ...
Posted by Guillaume Nodet <gn...@gmail.com>.
The content of the message itself is changed when the xml
needs to be read for logging or serialized. This is necessary
so that if you put a source based on a stream, you won't have
a EOF exception when the component processes the message.
So the Source are transformed to DOMSource, which can be
re-read at will.
On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
> Hi Guillaume,
> > The main cause would be that the exchange is logged at DEBUG
> > level. This means that the xml is displayed, and thus the Source
> > is transformed to a DOMSource. You can avoid that by changing
> > the log level to INFO, or by setting the system property
> > "org.apache.servicemix.preserveContent" to "true".
> I was examining the Source content by actually getting the content, and
> looking at the class of the Source object ... (?)
>
> Roger
> >
> > It seems also that the CopyTransformer do not recognize the
> > XStreamSource as a re-readable Source.
> > It means that if the message is transformed by the CopyTransformer,
> > it will be transformed to a DOM Source.
> >
> > On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
> >>
> >> Hi,
> >>
> >> I have a Sender and Receiver components (both extending
> >> ComponentSupport). The sender sends a message with the Source content as
> >> a XStreamSource. My understanding from the documentation is that the
> >> receiver can pick up the Source content of the in message as the
> >> original XStream pojo (avoiding the extra marshalling). However, in the
> >> case of a different receiver, not aware that the source is a JavaSource,
> >> it can use the DOM representation of the content. However, from all my
> >> experiments, the content of the Source of the incoming message at the
> >> receiver is always DOMSource, and I can't get hold of the original
> >> POJO ...
> >>
> >> Can anyone point out where I'm going wrong. I've looked through the
> >> testcases for something to help me out, but can't find something doing
> >> this exactly.
> >>
> >> Thanks,
> >>
> >> Roger
> >>
> >>
> >
> >
>
>
>
--
Cheers,
Guillaume Nodet
Re: XStreamSource, JavaSource and DOMSource ...
Posted by Roger Menday <r....@fz-juelich.de>.
Hi Guillaume,
> The main cause would be that the exchange is logged at DEBUG
> level. This means that the xml is displayed, and thus the Source
> is transformed to a DOMSource. You can avoid that by changing
> the log level to INFO, or by setting the system property
> "org.apache.servicemix.preserveContent" to "true".
I was examining the Source content by actually getting the content, and
looking at the class of the Source object ... (?)
Roger
>
> It seems also that the CopyTransformer do not recognize the
> XStreamSource as a re-readable Source.
> It means that if the message is transformed by the CopyTransformer,
> it will be transformed to a DOM Source.
>
> On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
>>
>> Hi,
>>
>> I have a Sender and Receiver components (both extending
>> ComponentSupport). The sender sends a message with the Source content as
>> a XStreamSource. My understanding from the documentation is that the
>> receiver can pick up the Source content of the in message as the
>> original XStream pojo (avoiding the extra marshalling). However, in the
>> case of a different receiver, not aware that the source is a JavaSource,
>> it can use the DOM representation of the content. However, from all my
>> experiments, the content of the Source of the incoming message at the
>> receiver is always DOMSource, and I can't get hold of the original
>> POJO ...
>>
>> Can anyone point out where I'm going wrong. I've looked through the
>> testcases for something to help me out, but can't find something doing
>> this exactly.
>>
>> Thanks,
>>
>> Roger
>>
>>
>
>
Re: XStreamSource, JavaSource and DOMSource ...
Posted by Guillaume Nodet <gn...@gmail.com>.
The main cause would be that the exchange is logged at DEBUG
level. This means that the xml is displayed, and thus the Source
is transformed to a DOMSource. You can avoid that by changing
the log level to INFO, or by setting the system property
"org.apache.servicemix.preserveContent" to "true".
It seems also that the CopyTransformer do not recognize the
XStreamSource as a re-readable Source.
It means that if the message is transformed by the CopyTransformer,
it will be transformed to a DOM Source.
On 10/31/06, Roger Menday <r....@fz-juelich.de> wrote:
>
> Hi,
>
> I have a Sender and Receiver components (both extending
> ComponentSupport). The sender sends a message with the Source content as
> a XStreamSource. My understanding from the documentation is that the
> receiver can pick up the Source content of the in message as the
> original XStream pojo (avoiding the extra marshalling). However, in the
> case of a different receiver, not aware that the source is a JavaSource,
> it can use the DOM representation of the content. However, from all my
> experiments, the content of the Source of the incoming message at the
> receiver is always DOMSource, and I can't get hold of the original POJO ...
>
> Can anyone point out where I'm going wrong. I've looked through the
> testcases for something to help me out, but can't find something doing
> this exactly.
>
> Thanks,
>
> Roger
>
>
--
Cheers,
Guillaume Nodet