Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8341

LoggingFeature always prints out binary contents

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.5.0, 3.4.3
    • logging
    • None
    • Unknown

    Description

      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:

      LoggingFeature lf = new LoggingFeature();
              lf.setPrettyLogging(false);
              lf.setLogBinary(false);
              lf.setLogMultipart(true);
      

      The MTOM attachment is printed in the log despite its content-type is application/octet-stream (already defined in the DefaultLogEventMapper).

      ...
      HttpMethod: POST
          Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:09d02828-bbcd-4ab7-9007-53cac8f6174d"; start="<root.message@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: <root.message@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: <0c5cb764-0821-4641-8dcc-27d0d119aece-1@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
      
      
      

      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

       

       

       

       

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            blashluke Luke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: