/**
* @
author wangyiwen
* @
version 1.0 Created in 2020/7/14 18:36
* 该注入是为了可以获取到包装过的 httpRequest
*/
public class WrapperRequestFilter extends AbstractRequestLoggingFilter {
/**
* Concrete subclasses should implement this method to write a log message
* <i>before</i> the request is processed.
*
* @
param request current HTTP request
* @
param message the message to log
*/
@
Override protected void beforeRequest(HttpServletRequest request, String message) {
//do nothing
}
/**
* Concrete subclasses should implement this method to write a log message
* <i>after</i> the request is processed.
*
* @
param request current HTTP request
* @
param message the message to log
*/
@
Override protected void afterRequest(HttpServletRequest request, String message) {
//do nothing
}
}
---------------------------------------------------------------------------------------------------
@
Bean public WrapperRequestFilter wrapperRequestFilter() {
WrapperRequestFilter wrapperRequestFilter = new WrapperRequestFilter();
wrapperRequestFilter.setIncludeQueryString(true);
wrapperRequestFilter.setIncludeClientInfo(true);
wrapperRequestFilter.setIncludeHeaders(true);
wrapperRequestFilter.setIncludePayload(true);
wrapperRequestFilter.setMaxPayloadLength(99999);
return wrapperRequestFilter;
}