You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Luke (Jira)" <ji...@apache.org> on 2020/09/19 15:17:00 UTC

[jira] [Created] (CXF-8341) LoggingFeature always print out binary contents

Luke created CXF-8341:
-------------------------

             Summary: LoggingFeature always print out binary contents
                 Key: CXF-8341
                 URL: https://issues.apache.org/jira/browse/CXF-8341
             Project: CXF
          Issue Type: Bug
          Components: logging
    Affects Versions: 3.4.0
            Reporter: Luke


As mentioned in the following (closed) old issue:

https://issues.apache.org/jira/browse/CXF-7143

it seems that the LoggingFeature and releated classes (LoggingInInterceptor, etc) don't treat correctly a SOAP MTOM message with multiple parts.

Configuring the LoggingFeature as follows:
{code:java}
LoggingFeature lf = new LoggingFeature();
        lf.setPrettyLogging(false);
        lf.setLogBinary(false);
        lf.setLogMultipart(true);
{code}
The MTOM attachment is printed in the log despite its content-type is application/octet-stream (already defined in the DefaultLogEventMapper).
{code:java}
...
HttpMethod: POST
    Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d"; start="<ro...@cxf.apache.org>"; start-info="application/soap+xml"
...
Payload: 
--uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <ro...@cxf.apache.org><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
...
</soap:Body></soap:Envelope>
--uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <0c...@cxf.apache.org>
Content-Disposition: attachment;name="pdf-sample.pdf"

---> THE BINARY CONTENT IS LOGGED HERE EVEN IF THE CONTENT TYPE IS application/octet-stream


{code}
It seems that the isBinaryContent() is evaluted only once for the whole message passing the content-type of the first part only (applcation/xop+xml).

I would like to have printed in the log only the SOAP XML payload (the first part) filtering out the binary parts (replacing them with the standard message "--- Content suppressed ---").

To recap, if I set LoggingFeature.setLogMultipart(false) also the SOAP XML Envelope disappear (as it is contained in a part), if I set LoggingFeature.setLogMultipart(true) and LoggingFeature.setLogBinary(false) the latter is ignored and the binary content are printed in the log.

Any help would be highly appreciated.

Luke

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)