Class SLF4JInterceptor

  • All Implemented Interfaces:
    org.apache.http.HttpRequestInterceptor, org.apache.http.HttpResponseInterceptor

    public class SLF4JInterceptor
    extends Object
    implements org.apache.http.HttpRequestInterceptor, org.apache.http.HttpResponseInterceptor
    A filter that logs both requests and responses to SLF4J. Available detail levels NONE - don't log anything MINIMAL - only log the verb, url, and response code HEADERS - as above, but also log all the headers for both the request and response FULL - as above, but also log the full body for both the request and response
    • Constructor Detail

      • SLF4JInterceptor

        public SLF4JInterceptor()
      • SLF4JInterceptor

        public SLF4JInterceptor​(DetailLevel detailLevel)
    • Method Detail

      • getDetailLevel

        public DetailLevel getDetailLevel()
        Returns:
        the current detail level of the filter
      • setDetailLevel

        public void setDetailLevel​(DetailLevel detailLevel)
        Sets the detail level
        Parameters:
        detailLevel - - the new detail level to use
      • process

        public void process​(org.apache.http.HttpRequest request,
                            org.apache.http.protocol.HttpContext context)
                     throws org.apache.http.HttpException,
                            IOException
        Specified by:
        process in interface org.apache.http.HttpRequestInterceptor
        Throws:
        org.apache.http.HttpException
        IOException
      • process

        public void process​(org.apache.http.HttpResponse response,
                            org.apache.http.protocol.HttpContext context)
                     throws org.apache.http.HttpException,
                            IOException
        Specified by:
        process in interface org.apache.http.HttpResponseInterceptor
        Throws:
        org.apache.http.HttpException
        IOException