You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Krisztian Kurucz (JIRA)" <ji...@apache.org> on 2019/06/16 14:49:00 UTC

[jira] [Commented] (CXF-8032) Adding LoggingFeature enables chunking response

    [ https://issues.apache.org/jira/browse/CXF-8032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16865031#comment-16865031 ] 

Krisztian Kurucz commented on CXF-8032:
---------------------------------------

Dear Team,

I derived a class from CacheAndWriteOutputStream and overrode the proper method, Content-Length was appeared properly.

Could you check the below, please?
{code:java}
public class MyCacheAndWriteOutputStream extends CacheAndWriteOutputStream {
    public MyCacheAndWriteOutputStream(OutputStream stream) {
        super(stream);
    }

    /**
     * Override, because there is no need to flush the flow-through stream.
     * Flushing will be done by the underlying OutputStream.
     *
     * @see org.apache.cxf.io.AbstractThresholdOutputStream#close()
     */
    @Override
    public void closeFlowthroughStream() throws IOException {
        getFlowThroughStream().close();
    }

    /**
     * Override, because there is no need to flush the flow-through stream.
     * Flushing will be done by the underlying OutputStream.
     *
     * @see org.apache.cxf.io.AbstractThresholdOutputStream#close()
     */
    @Override
    protected void postClose() throws IOException {
        getFlowThroughStream().close();
    }
}
{code}
-Krisz
  

> Adding LoggingFeature enables chunking response
> -----------------------------------------------
>
>                 Key: CXF-8032
>                 URL: https://issues.apache.org/jira/browse/CXF-8032
>             Project: CXF
>          Issue Type: Bug
>          Components: logging
>    Affects Versions: 3.3.1
>         Environment: OS - Windows 10
> Java  - 1.8.0_181
> Tomcat - 8.5
> CXF - 3.3.1
>            Reporter: karthic
>            Priority: Major
>              Labels: triaged
>
> Adding org.apache.cxf.feature.LoggingFeature to Bus feature affects the response header, it adds transfer encoding as chunked, where as without LoggingFeature the content length is set and no transfer encoding set.
> <jaxws:features>
>  <bean class="org.apache.cxf.feature.LoggingFeature" />
>  </jaxws:features>
> Response header when LoggingFeature is added,
> HTTP/1.1 200 
>  Content-Type: text/xml;charset=UTF-8
>  Transfer-Encoding: chunked
>  Date: Wed, 01 May 2019 05:43:46 GMT
> Response header when LoggingFeature is removed,
> HTTP/1.1 200 
>  Content-Type: text/xml;charset=UTF-8
>  Content-Length: 496
>  Date: Wed, 01 May 2019 06:30:04 GMT
> Possible issue may be because converting the original OutputStream to CacheAndWriteOutputStream, I am not able look into further



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)