Class HttpRequestResponseDebugLogUtil

java.lang.Object
org.hawaiiframework.logging.util.HttpRequestResponseDebugLogUtil

public class HttpRequestResponseDebugLogUtil 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:
3.0.0
  • Constructor Details

    • HttpRequestResponseDebugLogUtil

      public HttpRequestResponseDebugLogUtil()
  • Method Details

    • getTxRequestDebugOutput

      public String getTxRequestDebugOutput(jakarta.servlet.http.HttpServletRequest servletRequest, String headers, String body)
      Create a servlet request log output, containing the request line, headers and body.
      Parameters:
      servletRequest - The request.
      headers - The headers.
      body - The body.
      Returns:
      a formatted multi-line string with the HTTP request.
    • getTxResponseDebugOutput

      public String getTxResponseDebugOutput(String protocol, org.springframework.http.HttpStatus httpStatus, String headers, String body)
      Create a servlet response log output, containing the request line, headers and body.
      Parameters:
      protocol - The request's protocol.
      httpStatus - The http status.
      headers - The headers.
      body - The body.
      Returns:
      a formatted multi-line string with the HTTP response.
    • getCallRequestDebugOutput

      public String getCallRequestDebugOutput(org.springframework.http.HttpMethod method, String requestUri, String headers, String body)
      Create a http request log output, containing the request line, headers and body.
      Parameters:
      method - The method.
      requestUri - The request URI.
      headers - The headers.
      body - The body.
      Returns:
      a formatted multi-line string with the HTTP request.
    • getCallRequestDebugOutput

      public String getCallRequestDebugOutput(String method, String requestUri, String headers, String body)
      Create a http request log output, containing the request line, headers and body.
      Parameters:
      method - The method.
      requestUri - The request URI.
      headers - The headers.
      body - The body.
      Returns:
      a formatted multi-line string with the HTTP request.
    • getCallResponseDebugOutput

      public String getCallResponseDebugOutput(String headers, String body)
      Create a http response log output.
      Parameters:
      headers - The headers.
      body - The body.
      Returns:
      a formatted multi-line string with the HTTP response.