Skip to content

Commit 775bccc

Browse files
committed
Polishing
1 parent 852212d commit 775bccc

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ public class DispatcherServlet extends FrameworkServlet {
328328
/** List of ViewResolvers used by this servlet */
329329
private List<ViewResolver> viewResolvers;
330330

331+
331332
/**
332333
* Create a new {@code DispatcherServlet} that will create its own internal web
333334
* application context based on defaults and values provided through servlet
@@ -347,7 +348,7 @@ public class DispatcherServlet extends FrameworkServlet {
347348
*/
348349
public DispatcherServlet() {
349350
super();
350-
this.setDispatchOptionsRequest(true);
351+
setDispatchOptionsRequest(true);
351352
}
352353

353354
/**
@@ -391,9 +392,10 @@ public DispatcherServlet() {
391392
*/
392393
public DispatcherServlet(WebApplicationContext webApplicationContext) {
393394
super(webApplicationContext);
394-
this.setDispatchOptionsRequest(true);
395+
setDispatchOptionsRequest(true);
395396
}
396397

398+
397399
/**
398400
* Set whether to detect all HandlerMapping beans in this servlet's context. Otherwise,
399401
* just a single bean with name "handlerMapping" will be expected.
@@ -465,6 +467,7 @@ public void setCleanupAfterInclude(boolean cleanupAfterInclude) {
465467
this.cleanupAfterInclude = cleanupAfterInclude;
466468
}
467469

470+
468471
/**
469472
* This implementation calls {@link #initStrategies}.
470473
*/
@@ -549,9 +552,8 @@ private void initThemeResolver(ApplicationContext context) {
549552
// We need to use the default.
550553
this.themeResolver = getDefaultStrategy(context, ThemeResolver.class);
551554
if (logger.isDebugEnabled()) {
552-
logger.debug(
553-
"Unable to locate ThemeResolver with name '" + THEME_RESOLVER_BEAN_NAME + "': using default [" +
554-
this.themeResolver + "]");
555+
logger.debug("Unable to locate ThemeResolver with name '" + THEME_RESOLVER_BEAN_NAME +
556+
"': using default [" + this.themeResolver + "]");
555557
}
556558
}
557559
}
@@ -739,8 +741,7 @@ private void initViewResolvers(ApplicationContext context) {
739741
*/
740742
private void initFlashMapManager(ApplicationContext context) {
741743
try {
742-
this.flashMapManager =
743-
context.getBean(FLASH_MAP_MANAGER_BEAN_NAME, FlashMapManager.class);
744+
this.flashMapManager = context.getBean(FLASH_MAP_MANAGER_BEAN_NAME, FlashMapManager.class);
744745
if (logger.isDebugEnabled()) {
745746
logger.debug("Using FlashMapManager [" + this.flashMapManager + "]");
746747
}
@@ -840,7 +841,8 @@ protected <T> List<T> getDefaultStrategies(ApplicationContext context, Class<T>
840841

841842
/**
842843
* Create a default strategy.
843-
* <p>The default implementation uses {@link org.springframework.beans.factory.config.AutowireCapableBeanFactory#createBean}.
844+
* <p>The default implementation uses
845+
* {@link org.springframework.beans.factory.config.AutowireCapableBeanFactory#createBean}.
844846
* @param context the current WebApplicationContext
845847
* @param clazz the strategy implementation class to instantiate
846848
* @return the fully configured strategy instance
@@ -1101,7 +1103,8 @@ else if (request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE) instanceof Mul
11011103
* @see MultipartResolver#cleanupMultipart
11021104
*/
11031105
protected void cleanupMultipart(HttpServletRequest request) {
1104-
MultipartHttpServletRequest multipartRequest = WebUtils.getNativeRequest(request, MultipartHttpServletRequest.class);
1106+
MultipartHttpServletRequest multipartRequest =
1107+
WebUtils.getNativeRequest(request, MultipartHttpServletRequest.class);
11051108
if (multipartRequest != null) {
11061109
this.multipartResolver.cleanupMultipart(multipartRequest);
11071110
}

spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import org.springframework.util.ClassUtils;
4747
import org.springframework.util.ObjectUtils;
4848
import org.springframework.util.StringUtils;
49-
import org.springframework.web.bind.annotation.RequestMethod;
5049
import org.springframework.web.context.ConfigurableWebApplicationContext;
5150
import org.springframework.web.context.ConfigurableWebEnvironment;
5251
import org.springframework.web.context.ContextLoader;
@@ -919,7 +918,7 @@ protected void doOptions(HttpServletRequest request, HttpServletResponse respons
919918
@Override
920919
public void setHeader(String name, String value) {
921920
if ("Allow".equals(name)) {
922-
value = (StringUtils.hasLength(value) ? value + ", " : "") + RequestMethod.PATCH.name();
921+
value = (StringUtils.hasLength(value) ? value + ", " : "") + HttpMethod.PATCH.name();
923922
}
924923
super.setHeader(name, value);
925924
}

0 commit comments

Comments
 (0)