update 优化 pr194 代码
This commit is contained in:
parent
1270b6717f
commit
a0a09c23da
@ -49,7 +49,7 @@ public class XssFilter implements Filter {
|
|||||||
String url = request.getServletPath();
|
String url = request.getServletPath();
|
||||||
String method = request.getMethod();
|
String method = request.getMethod();
|
||||||
// GET DELETE 不过滤
|
// GET DELETE 不过滤
|
||||||
if (method == null || method.matches(HttpMethod.GET.name()) || method.matches(HttpMethod.DELETE.name())) {
|
if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return StringUtils.matches(url, excludes);
|
return StringUtils.matches(url, excludes);
|
||||||
|
@ -28,13 +28,13 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private static final String PROD_PROFILE = "prod";
|
private final String prodProfile = "prod";
|
||||||
|
|
||||||
private final TransmittableThreadLocal<StopWatch> invokeTimeTL = new TransmittableThreadLocal<>();
|
private final TransmittableThreadLocal<StopWatch> invokeTimeTL = new TransmittableThreadLocal<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
if (!PROD_PROFILE.equals(SpringUtils.getActiveProfile())) {
|
if (!prodProfile.equals(SpringUtils.getActiveProfile())) {
|
||||||
String url = request.getMethod() + " " + request.getRequestURI();
|
String url = request.getMethod() + " " + request.getRequestURI();
|
||||||
|
|
||||||
// 打印请求参数
|
// 打印请求参数
|
||||||
@ -69,7 +69,7 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
if (!PROD_PROFILE.equals(SpringUtils.getActiveProfile())) {
|
if (!prodProfile.equals(SpringUtils.getActiveProfile())) {
|
||||||
StopWatch stopWatch = invokeTimeTL.get();
|
StopWatch stopWatch = invokeTimeTL.get();
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
log.debug("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
|
log.debug("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user