Skip to content

Commit 7382315

Browse files
committed
Polishing
1 parent a385153 commit 7382315

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
9191

9292
/**
9393
* Set whether the query string should be included in the log message.
94-
* <p>Should be configured using an {@code &lt;init-param&gt;} for parameter name
94+
* <p>Should be configured using an {@code <init-param>} for parameter name
9595
* "includeQueryString" in the filter definition in {@code web.xml}.
9696
*/
9797
public void setIncludeQueryString(boolean includeQueryString) {
@@ -108,7 +108,7 @@ protected boolean isIncludeQueryString() {
108108
/**
109109
* Set whether the client address and session id should be included in the
110110
* log message.
111-
* <p>Should be configured using an {@code &lt;init-param&gt;} for parameter name
111+
* <p>Should be configured using an {@code <init-param>} for parameter name
112112
* "includeClientInfo" in the filter definition in {@code web.xml}.
113113
*/
114114
public void setIncludeClientInfo(boolean includeClientInfo) {
@@ -125,7 +125,7 @@ protected boolean isIncludeClientInfo() {
125125

126126
/**
127127
* Set whether the request payload (body) should be included in the log message.
128-
* <p>Should be configured using an {@code &lt;init-param&gt;} for parameter name
128+
* <p>Should be configured using an {@code <init-param>} for parameter name
129129
* "includePayload" in the filter definition in {@code web.xml}.
130130
*/
131131

@@ -288,7 +288,6 @@ protected String createMessage(HttpServletRequest request, String prefix, String
288288
}
289289
msg.append(";payload=").append(payload);
290290
}
291-
292291
}
293292
msg.append(suffix);
294293
return msg.toString();
@@ -320,7 +319,7 @@ private static class RequestCachingRequestWrapper extends HttpServletRequestWrap
320319

321320
private BufferedReader reader;
322321

323-
private RequestCachingRequestWrapper(HttpServletRequest request) throws IOException {
322+
public RequestCachingRequestWrapper(HttpServletRequest request) throws IOException {
324323
super(request);
325324
this.inputStream = new RequestCachingInputStream(request.getInputStream());
326325
}

spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
3131
* Encapsulates information about an {@linkplain ControllerAdvice @ControllerAdvice}
3232
* Spring-managed bean without necessarily requiring it to be instantiated.
3333
*
34-
* <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to discover
35-
* such beans. However, an {@code ControllerAdviceBean} may be created from
36-
* any object, including ones without an {@code @ControllerAdvice}.
34+
* <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to
35+
* discover such beans. However, a {@code ControllerAdviceBean} may be created
36+
* from any object, including ones without an {@code @ControllerAdvice}.
3737
*
3838
* @author Rossen Stoyanchev
3939
* @since 3.2
@@ -42,13 +42,24 @@ public class ControllerAdviceBean implements Ordered {
4242

4343
private final Object bean;
4444

45+
private final BeanFactory beanFactory;
46+
4547
private final int order;
4648

47-
private final BeanFactory beanFactory;
4849

50+
/**
51+
* Create a {@code ControllerAdviceBean} using the given bean instance.
52+
* @param bean the bean instance
53+
*/
54+
public ControllerAdviceBean(Object bean) {
55+
Assert.notNull(bean, "Bean must not be null");
56+
this.bean = bean;
57+
this.order = initOrderFromBean(bean);
58+
this.beanFactory = null;
59+
}
4960

5061
/**
51-
* Create an instance using the given bean name.
62+
* Create a {@code ControllerAdviceBean} using the given bean name.
5263
* @param beanName the name of the bean
5364
* @param beanFactory a BeanFactory that can be used later to resolve the bean
5465
*/
@@ -66,29 +77,19 @@ public ControllerAdviceBean(String beanName, BeanFactory beanFactory) {
6677
this.order = initOrderFromBeanType(this.beanFactory.getType(beanName));
6778
}
6879

69-
/**
70-
* Create an instance using the given bean instance.
71-
* @param bean the bean
72-
*/
73-
public ControllerAdviceBean(Object bean) {
74-
Assert.notNull(bean, "Bean must not be null");
75-
this.bean = bean;
76-
this.order = initOrderFromBean(bean);
77-
this.beanFactory = null;
78-
}
79-
8080

8181
/**
8282
* Returns the order value extracted from the {@link ControllerAdvice}
83-
* annotation or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
83+
* annotation, or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
8484
*/
8585
public int getOrder() {
8686
return this.order;
8787
}
8888

8989
/**
90-
* Returns the type of the contained bean.
91-
* If the bean type is a CGLIB-generated class, the original, user-defined class is returned.
90+
* Return the type of the contained bean.
91+
* <p>If the bean type is a CGLIB-generated class, the original
92+
* user-defined class is returned.
9293
*/
9394
public Class<?> getBeanType() {
9495
Class<?> clazz = (this.bean instanceof String ?

0 commit comments

Comments
 (0)