Class HttpRequestResponseBodyLogUtil


  • public class HttpRequestResponseBodyLogUtil
    extends Object
    Utility for logging requests / responses.

    The utility can be used to generate HTTP request / response log strings. Both for incoming service calls as outgoing calls (i.e. calls to backend systems).

    Since:
    2.0.0
    Author:
    Rutger Lubbers
    • Constructor Detail

      • HttpRequestResponseBodyLogUtil

        public HttpRequestResponseBodyLogUtil()
    • Method Detail

      • getTxRequestBody

        public String getTxRequestBody​(javax.servlet.http.HttpServletRequest servletRequest)
                                throws IOException
        Get the request body. With password masking.
        Parameters:
        servletRequest - The servlet request.
        Returns:
        The body.
        Throws:
        IOException - In case the body could not be read.
      • getTxResponseBody

        public String getTxResponseBody​(ContentCachingWrappedResponse servletResponse)
        Get the response body. With password masking.
        Parameters:
        servletResponse - The servlet response.
        Returns:
        The body.
      • getCallRequestBody

        public String getCallRequestBody​(byte[] body)
        Get the call request body. With password masking.
        Parameters:
        body - The http request body.
        Returns:
        The body.
      • getCallResponseBody

        public String getCallResponseBody​(org.springframework.http.client.ClientHttpResponse response)
                                   throws IOException
        Get the call response body. With password masking.
        Parameters:
        response - The http response.
        Returns:
        The body.
        Throws:
        IOException