You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Karlsen <da...@gmail.com> on 2013/06/24 13:34:45 UTC
HTTP header removed when response is streamed via file.
Hi.
I have this out/outFault interceptor:
public Sorp3Interceptor()
throws JAXBException
{
super( Phase.POST_PROTOCOL, EDBHeaderType.class );
}
public void handleMessage( SoapMessage message )
throws Fault
{
if ( isRequestor( message ) )
{
logger.warn( "Wrongly configured - this interceptor should only
be used serverside for outbound messages (e.g. replies) - ignoring" );
return;
}
@SuppressWarnings( "unchecked" )
Map<String, List<String>> headers = (Map<String, List<String>>)
message.get( Message.PROTOCOL_HEADERS );
if ( headers == null )
{
headers = Maps.newTreeMap( String.CASE_INSENSITIVE_ORDER );
message.put( Message.PROTOCOL_HEADERS, headers );
}
headers.put( "X-sorp", Arrays.asList( getSorp3HeaderValue( message
) ) );
}
it works fine, but we see that when the response is so large that it's
streamed via file (e.g reaching the threshold for CachedOutputStream) it's
not actually received by the client:
E.g. this one will lack the header when received by client:
ID: 6
Encoding: UTF-8
Content-Type: text/xml
Headers: {X-sorp=[anonymized]}
Messages: Outbound Message (saved to tmp file):
Filename: /tmp/cxf-tmp-250758/cos4006683562610207802tmp
(message truncated to 102400 bytes)
this one works as designed:
ID: 7
Encoding: UTF-8
Content-Type: text/xml
Headers: {X-sorp=[anonymized]}
Payload: <soap:Envelope ...
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
Re: HTTP header removed when response is streamed via file.
Posted by Daniel Kulp <dk...@apache.org>.
On Jun 25, 2013, at 3:57 AM, David Karlsen <da...@gmail.com> wrote:
> Answering myself - found this:
> https://issues.apache.org/jira/browse/CXF-4930
> will try that.
Yep. Try a different phase. :-)
Dan
>
>
> 2013/6/25 David Karlsen <da...@gmail.com>
>
>> No-one? Then I recon it's a bug.
>>
>>
>> 2013/6/24 David Karlsen <da...@gmail.com>
>>
>>> Hi.
>>>
>>> I have this out/outFault interceptor:
>>>
>>> public Sorp3Interceptor()
>>> throws JAXBException
>>> {
>>> super( Phase.POST_PROTOCOL, EDBHeaderType.class );
>>> }
>>>
>>> public void handleMessage( SoapMessage message )
>>> throws Fault
>>> {
>>> if ( isRequestor( message ) )
>>> {
>>> logger.warn( "Wrongly configured - this interceptor should
>>> only be used serverside for outbound messages (e.g. replies) - ignoring" );
>>> return;
>>> }
>>>
>>> @SuppressWarnings( "unchecked" )
>>> Map<String, List<String>> headers = (Map<String, List<String>>)
>>> message.get( Message.PROTOCOL_HEADERS );
>>>
>>> if ( headers == null )
>>> {
>>> headers = Maps.newTreeMap( String.CASE_INSENSITIVE_ORDER );
>>> message.put( Message.PROTOCOL_HEADERS, headers );
>>> }
>>>
>>> headers.put( "X-sorp", Arrays.asList( getSorp3HeaderValue(
>>> message ) ) );
>>> }
>>>
>>>
>>> it works fine, but we see that when the response is so large that it's
>>> streamed via file (e.g reaching the threshold for CachedOutputStream) it's
>>> not actually received by the client:
>>>
>>>
>>> E.g. this one will lack the header when received by client:
>>> ID: 6
>>> Encoding: UTF-8
>>> Content-Type: text/xml
>>> Headers: {X-sorp=[anonymized]}
>>> Messages: Outbound Message (saved to tmp file):
>>> Filename: /tmp/cxf-tmp-250758/cos4006683562610207802tmp
>>> (message truncated to 102400 bytes)
>>>
>>>
>>> this one works as designed:
>>>
>>> ID: 7
>>> Encoding: UTF-8
>>> Content-Type: text/xml
>>> Headers: {X-sorp=[anonymized]}
>>> Payload: <soap:Envelope ...
>>>
>>>
>>>
>>>
>>>
>>> --
>>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>>
>>
>>
>>
>> --
>> --
>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>
>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Re: HTTP header removed when response is streamed via file.
Posted by David Karlsen <da...@gmail.com>.
Answering myself - found this:
https://issues.apache.org/jira/browse/CXF-4930
will try that.
2013/6/25 David Karlsen <da...@gmail.com>
> No-one? Then I recon it's a bug.
>
>
> 2013/6/24 David Karlsen <da...@gmail.com>
>
>> Hi.
>>
>> I have this out/outFault interceptor:
>>
>> public Sorp3Interceptor()
>> throws JAXBException
>> {
>> super( Phase.POST_PROTOCOL, EDBHeaderType.class );
>> }
>>
>> public void handleMessage( SoapMessage message )
>> throws Fault
>> {
>> if ( isRequestor( message ) )
>> {
>> logger.warn( "Wrongly configured - this interceptor should
>> only be used serverside for outbound messages (e.g. replies) - ignoring" );
>> return;
>> }
>>
>> @SuppressWarnings( "unchecked" )
>> Map<String, List<String>> headers = (Map<String, List<String>>)
>> message.get( Message.PROTOCOL_HEADERS );
>>
>> if ( headers == null )
>> {
>> headers = Maps.newTreeMap( String.CASE_INSENSITIVE_ORDER );
>> message.put( Message.PROTOCOL_HEADERS, headers );
>> }
>>
>> headers.put( "X-sorp", Arrays.asList( getSorp3HeaderValue(
>> message ) ) );
>> }
>>
>>
>> it works fine, but we see that when the response is so large that it's
>> streamed via file (e.g reaching the threshold for CachedOutputStream) it's
>> not actually received by the client:
>>
>>
>> E.g. this one will lack the header when received by client:
>> ID: 6
>> Encoding: UTF-8
>> Content-Type: text/xml
>> Headers: {X-sorp=[anonymized]}
>> Messages: Outbound Message (saved to tmp file):
>> Filename: /tmp/cxf-tmp-250758/cos4006683562610207802tmp
>> (message truncated to 102400 bytes)
>>
>>
>> this one works as designed:
>>
>> ID: 7
>> Encoding: UTF-8
>> Content-Type: text/xml
>> Headers: {X-sorp=[anonymized]}
>> Payload: <soap:Envelope ...
>>
>>
>>
>>
>>
>> --
>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>
>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
Re: HTTP header removed when response is streamed via file.
Posted by David Karlsen <da...@gmail.com>.
No-one? Then I recon it's a bug.
2013/6/24 David Karlsen <da...@gmail.com>
> Hi.
>
> I have this out/outFault interceptor:
>
> public Sorp3Interceptor()
> throws JAXBException
> {
> super( Phase.POST_PROTOCOL, EDBHeaderType.class );
> }
>
> public void handleMessage( SoapMessage message )
> throws Fault
> {
> if ( isRequestor( message ) )
> {
> logger.warn( "Wrongly configured - this interceptor should
> only be used serverside for outbound messages (e.g. replies) - ignoring" );
> return;
> }
>
> @SuppressWarnings( "unchecked" )
> Map<String, List<String>> headers = (Map<String, List<String>>)
> message.get( Message.PROTOCOL_HEADERS );
>
> if ( headers == null )
> {
> headers = Maps.newTreeMap( String.CASE_INSENSITIVE_ORDER );
> message.put( Message.PROTOCOL_HEADERS, headers );
> }
>
> headers.put( "X-sorp", Arrays.asList( getSorp3HeaderValue( message
> ) ) );
> }
>
>
> it works fine, but we see that when the response is so large that it's
> streamed via file (e.g reaching the threshold for CachedOutputStream) it's
> not actually received by the client:
>
>
> E.g. this one will lack the header when received by client:
> ID: 6
> Encoding: UTF-8
> Content-Type: text/xml
> Headers: {X-sorp=[anonymized]}
> Messages: Outbound Message (saved to tmp file):
> Filename: /tmp/cxf-tmp-250758/cos4006683562610207802tmp
> (message truncated to 102400 bytes)
>
>
> this one works as designed:
>
> ID: 7
> Encoding: UTF-8
> Content-Type: text/xml
> Headers: {X-sorp=[anonymized]}
> Payload: <soap:Envelope ...
>
>
>
>
>
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen