Class JsonHttpLogFormatterJackson2

java.lang.Object
org.zalando.logbook.json.JsonHttpLogFormatterJackson2
All Implemented Interfaces:
org.zalando.logbook.HttpLogFormatter, org.zalando.logbook.StructuredHttpLogFormatter

@API(status=STABLE) @Deprecated(since="4.0.0", forRemoval=true) public final class JsonHttpLogFormatterJackson2 extends Object implements org.zalando.logbook.StructuredHttpLogFormatter
Deprecated, for removal: This API element is subject to removal in a future version.
A custom HttpLogFormatter that produces JSON objects. It can be augmented with composition:
 

 public class CustomsFormatter implements HttpLogFormatter {

     private final JsonHttpLogFormatter delegate;

     public CustomsFormatter(ObjectMapper mapper) {
         this.delegate = new JsonHttpLogFormatter(mapper);
     }

     public String format(Precorrelation precorrelation, HttpRequest request) throws IOException {
         Map<String, Object> content = delegate.prepare(precorrelation, request);
         // modify request here
         return delegate.format(content);
     }

     public String format(Correlation correlation, HttpResponse response) throws IOException {
         Map<String, Object> content = delegate.prepare(correlation, response);
         // modify response here
         return delegate.format(content);
      }

 }
 
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    JsonHttpLogFormatterJackson2(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    format(Map<String,Object> content)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    prepareBody(org.zalando.logbook.HttpMessage message)
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.zalando.logbook.StructuredHttpLogFormatter

    format, format, prepare, prepare, prepareHeaders, preparePort
  • Constructor Details

    • JsonHttpLogFormatterJackson2

      public JsonHttpLogFormatterJackson2()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • JsonHttpLogFormatterJackson2

      public JsonHttpLogFormatterJackson2(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • prepareBody

      public Optional<Object> prepareBody(org.zalando.logbook.HttpMessage message) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      prepareBody in interface org.zalando.logbook.StructuredHttpLogFormatter
      Throws:
      IOException
    • format

      public String format(Map<String,Object> content) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      format in interface org.zalando.logbook.StructuredHttpLogFormatter
      Throws:
      IOException