View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.cxf.feature;
8   
9   import java.io.PrintWriter;
10  
11  import org.apache.cxf.interceptor.LoggingOutInterceptor;
12  
13  /**
14   * Takes the log output from the standard CXF LoggingInterceptor, 
15   * disassembles it, pretty-prints the XML payload, then puts it all back 
16   * together again.
17   */
18  public class PrettyLoggingOutInterceptor extends LoggingOutInterceptor
19  {
20      public PrettyLoggingOutInterceptor()
21      {
22          super();
23      }
24  
25      public PrettyLoggingOutInterceptor(String phase)
26      {
27          super(phase);
28      }
29  
30      public PrettyLoggingOutInterceptor(int lim)
31      {
32          super(lim);
33      }
34  
35      public PrettyLoggingOutInterceptor(PrintWriter w)
36      {
37          super(w);
38      }
39  
40      @Override
41      protected String transform(String originalLogString)
42      {
43          return PrettyLoggingFeature.formatXmlPayload(originalLogString);
44      }
45  }