Package org.hawaiiframework.logging.util
Class HttpRequestResponseBodyLogUtil
java.lang.Object
org.hawaiiframework.logging.util.HttpRequestResponseBodyLogUtil
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
-
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestResponseBodyLogUtil(PasswordMaskerUtil passwordMasker) The constructor for the log utility. -
Method Summary
Modifier and TypeMethodDescriptiongetCallRequestBody(byte[] body) Get the call request body.getCallResponseBody(org.springframework.http.client.ClientHttpResponse response) Get the call response body.getTxRequestBody(jakarta.servlet.http.HttpServletRequest servletRequest) Get the request body.getTxResponseBody(ContentCachingWrappedResponse servletResponse) Get the response body.
-
Constructor Details
-
HttpRequestResponseBodyLogUtil
The constructor for the log utility.- Parameters:
passwordMasker- The password masker utility.
-
-
Method Details
-
getTxRequestBody
public String getTxRequestBody(jakarta.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
Get the response body. With password masking.- Parameters:
servletResponse- The servlet response.- Returns:
- The body.
-
getCallRequestBody
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- in case something went wrong getting the payload from the response.
-