Package org.hawaiiframework.logging.util
Class HttpRequestResponseBodyLogUtil
- java.lang.Object
-
- org.hawaiiframework.logging.util.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 Summary
Constructors Constructor Description HttpRequestResponseBodyLogUtil(PasswordMaskerUtil passwordMasker)
The constructor for the log utility.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCallRequestBody(byte[] body)
Get the call request body.String
getCallResponseBody(org.springframework.http.client.ClientHttpResponse response)
Get the call response body.String
getTxRequestBody(javax.servlet.http.HttpServletRequest servletRequest)
Get the request body.String
getTxResponseBody(ContentCachingWrappedResponse servletResponse)
Get the response body.
-
-
-
Constructor Detail
-
HttpRequestResponseBodyLogUtil
public HttpRequestResponseBodyLogUtil(PasswordMaskerUtil passwordMasker)
The constructor for the log utility.- Parameters:
passwordMasker
- The password masker utility.
-
-
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
-
-