Polishing
This commit is contained in:
@@ -91,7 +91,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
|
||||
/**
|
||||
* Set whether the query string should be included in the log message.
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* "includeQueryString" in the filter definition in {@code web.xml}.
|
||||
*/
|
||||
public void setIncludeQueryString(boolean includeQueryString) {
|
||||
@@ -108,7 +108,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
/**
|
||||
* Set whether the client address and session id should be included in the
|
||||
* log message.
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* "includeClientInfo" in the filter definition in {@code web.xml}.
|
||||
*/
|
||||
public void setIncludeClientInfo(boolean includeClientInfo) {
|
||||
@@ -125,7 +125,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
|
||||
/**
|
||||
* Set whether the request payload (body) should be included in the log message.
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* "includePayload" in the filter definition in {@code web.xml}.
|
||||
*/
|
||||
|
||||
@@ -288,7 +288,6 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
}
|
||||
msg.append(";payload=").append(payload);
|
||||
}
|
||||
|
||||
}
|
||||
msg.append(suffix);
|
||||
return msg.toString();
|
||||
@@ -320,7 +319,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
|
||||
private BufferedReader reader;
|
||||
|
||||
private RequestCachingRequestWrapper(HttpServletRequest request) throws IOException {
|
||||
public RequestCachingRequestWrapper(HttpServletRequest request) throws IOException {
|
||||
super(request);
|
||||
this.inputStream = new RequestCachingInputStream(request.getInputStream());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,9 +31,9 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
* Encapsulates information about an {@linkplain ControllerAdvice @ControllerAdvice}
|
||||
* Spring-managed bean without necessarily requiring it to be instantiated.
|
||||
*
|
||||
* <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to discover
|
||||
* such beans. However, an {@code ControllerAdviceBean} may be created from
|
||||
* any object, including ones without an {@code @ControllerAdvice}.
|
||||
* <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to
|
||||
* discover such beans. However, a {@code ControllerAdviceBean} may be created
|
||||
* from any object, including ones without an {@code @ControllerAdvice}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.2
|
||||
@@ -42,13 +42,24 @@ public class ControllerAdviceBean implements Ordered {
|
||||
|
||||
private final Object bean;
|
||||
|
||||
private final int order;
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
private final int order;
|
||||
|
||||
|
||||
/**
|
||||
* Create an instance using the given bean name.
|
||||
* Create a {@code ControllerAdviceBean} using the given bean instance.
|
||||
* @param bean the bean instance
|
||||
*/
|
||||
public ControllerAdviceBean(Object bean) {
|
||||
Assert.notNull(bean, "Bean must not be null");
|
||||
this.bean = bean;
|
||||
this.order = initOrderFromBean(bean);
|
||||
this.beanFactory = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code ControllerAdviceBean} using the given bean name.
|
||||
* @param beanName the name of the bean
|
||||
* @param beanFactory a BeanFactory that can be used later to resolve the bean
|
||||
*/
|
||||
@@ -66,29 +77,19 @@ public class ControllerAdviceBean implements Ordered {
|
||||
this.order = initOrderFromBeanType(this.beanFactory.getType(beanName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance using the given bean instance.
|
||||
* @param bean the bean
|
||||
*/
|
||||
public ControllerAdviceBean(Object bean) {
|
||||
Assert.notNull(bean, "Bean must not be null");
|
||||
this.bean = bean;
|
||||
this.order = initOrderFromBean(bean);
|
||||
this.beanFactory = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the order value extracted from the {@link ControllerAdvice}
|
||||
* annotation or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
|
||||
* annotation, or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
|
||||
*/
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the contained bean.
|
||||
* If the bean type is a CGLIB-generated class, the original, user-defined class is returned.
|
||||
* Return the type of the contained bean.
|
||||
* <p>If the bean type is a CGLIB-generated class, the original
|
||||
* user-defined class is returned.
|
||||
*/
|
||||
public Class<?> getBeanType() {
|
||||
Class<?> clazz = (this.bean instanceof String ?
|
||||
|
||||
Reference in New Issue
Block a user