summaryrefslogtreecommitdiff
path: root/spring-webmvc/src/main/java/org/springframework/web
diff options
context:
space:
mode:
Diffstat (limited to 'spring-webmvc/src/main/java/org/springframework/web')
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java10
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java8
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java14
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java10
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java8
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java61
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java17
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java4
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java4
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java4
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java4
-rw-r--r--spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java22
12 files changed, 81 insertions, 85 deletions
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
index da047ed0..9aa9ff5a 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -1095,8 +1095,8 @@ public class DispatcherServlet extends FrameworkServlet {
logger.debug("Request is already a MultipartHttpServletRequest - if not in a forward, " +
"this typically results from an additional MultipartFilter in web.xml");
}
- else if (hasMultipartException(request) ) {
- logger.debug("Multipart resolution failed for current request before - " +
+ else if (hasMultipartException(request)) {
+ logger.debug("Multipart resolution previously failed for current request - " +
"skipping re-resolution for undisturbed error rendering");
}
else {
@@ -1345,7 +1345,7 @@ public class DispatcherServlet extends FrameworkServlet {
* @param attributesSnapshot the snapshot of the request attributes before the include
*/
@SuppressWarnings("unchecked")
- private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?> attributesSnapshot) {
+ private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?, ?> attributesSnapshot) {
// Need to copy into separate Collection here, to avoid side effects
// on the Enumeration when removing attributes.
Set<String> attrsToCheck = new HashSet<String>();
@@ -1364,7 +1364,7 @@ public class DispatcherServlet extends FrameworkServlet {
// or removing the attribute, respectively, if appropriate.
for (String attrName : attrsToCheck) {
Object attrValue = attributesSnapshot.get(attrName);
- if (attrValue == null){
+ if (attrValue == null) {
request.removeAttribute(attrName);
}
else if (attrValue != request.getAttribute(attrName)) {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
index 627994d3..7f27b8c0 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -206,7 +206,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
}
configurePathMatchingProperties(handlerMappingDef, element, context);
- readerContext.getRegistry().registerBeanDefinition(HANDLER_MAPPING_BEAN_NAME , handlerMappingDef);
+ readerContext.getRegistry().registerBeanDefinition(HANDLER_MAPPING_BEAN_NAME, handlerMappingDef);
RuntimeBeanReference corsRef = MvcNamespaceUtils.registerCorsConfigurations(null, context, source);
handlerMappingDef.getPropertyValues().add("corsConfigurations", corsRef);
@@ -264,7 +264,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
handlerAdapterDef.getPropertyValues().add("callableInterceptors", callableInterceptors);
handlerAdapterDef.getPropertyValues().add("deferredResultInterceptors", deferredResultInterceptors);
- readerContext.getRegistry().registerBeanDefinition(HANDLER_ADAPTER_BEAN_NAME , handlerAdapterDef);
+ readerContext.getRegistry().registerBeanDefinition(HANDLER_ADAPTER_BEAN_NAME, handlerAdapterDef);
RootBeanDefinition uriContributorDef =
new RootBeanDefinition(CompositeUriComponentsContributorFactoryBean.class);
@@ -387,7 +387,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
factoryBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
factoryBeanDef.getPropertyValues().add("mediaTypes", getDefaultMediaTypes());
String name = CONTENT_NEGOTIATION_MANAGER_BEAN_NAME;
- context.getReaderContext().getRegistry().registerBeanDefinition(name , factoryBeanDef);
+ context.getReaderContext().getRegistry().registerBeanDefinition(name, factoryBeanDef);
context.registerComponent(new BeanComponentDefinition(factoryBeanDef, name));
beanRef = new RuntimeBeanReference(name);
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java
index ed3ea853..4945be22 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -81,8 +81,8 @@ public abstract class MvcNamespaceUtils {
}
parserContext.getRegistry().registerAlias(urlPathHelperRef.getBeanName(), URL_PATH_HELPER_BEAN_NAME);
}
- else if (!parserContext.getRegistry().isAlias(URL_PATH_HELPER_BEAN_NAME)
- && !parserContext.getRegistry().containsBeanDefinition(URL_PATH_HELPER_BEAN_NAME)) {
+ else if (!parserContext.getRegistry().isAlias(URL_PATH_HELPER_BEAN_NAME) &&
+ !parserContext.getRegistry().containsBeanDefinition(URL_PATH_HELPER_BEAN_NAME)) {
RootBeanDefinition urlPathHelperDef = new RootBeanDefinition(UrlPathHelper.class);
urlPathHelperDef.setSource(source);
urlPathHelperDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -106,8 +106,8 @@ public abstract class MvcNamespaceUtils {
}
parserContext.getRegistry().registerAlias(pathMatcherRef.getBeanName(), PATH_MATCHER_BEAN_NAME);
}
- else if (!parserContext.getRegistry().isAlias(PATH_MATCHER_BEAN_NAME)
- && !parserContext.getRegistry().containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) {
+ else if (!parserContext.getRegistry().isAlias(PATH_MATCHER_BEAN_NAME) &&
+ !parserContext.getRegistry().containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) {
RootBeanDefinition pathMatcherDef = new RootBeanDefinition(AntPathMatcher.class);
pathMatcherDef.setSource(source);
pathMatcherDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -122,7 +122,7 @@ public abstract class MvcNamespaceUtils {
* name unless already registered.
*/
private static void registerBeanNameUrlHandlerMapping(ParserContext context, Object source) {
- if (!context.getRegistry().containsBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME)){
+ if (!context.getRegistry().containsBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME)) {
RootBeanDefinition mappingDef = new RootBeanDefinition(BeanNameUrlHandlerMapping.class);
mappingDef.setSource(source);
mappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -193,7 +193,7 @@ public abstract class MvcNamespaceUtils {
* unless already registered.
*/
private static void registerHandlerMappingIntrospector(ParserContext parserContext, Object source) {
- if (!parserContext.getRegistry().containsBeanDefinition(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)){
+ if (!parserContext.getRegistry().containsBeanDefinition(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) {
RootBeanDefinition beanDef = new RootBeanDefinition(HandlerMappingIntrospector.class);
beanDef.setSource(source);
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java
index 48571d6b..dccb28d0 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -152,7 +152,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
* both "/test" and "/team". For details, see the AntPathMatcher class.
* <p>Looks for the most exact pattern, where most exact is defined as
* the longest path pattern.
- * @param urlPath URL the bean is mapped to
+ * @param urlPath the URL the bean is mapped to
* @param request current HTTP request (to expose the path within the mapping to)
* @return the associated handler instance, or {@code null} if not found
* @see #exposePathWithinMapping
@@ -179,7 +179,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
}
else if (useTrailingSlashMatch()) {
if (!registeredPattern.endsWith("/") && getPathMatcher().match(registeredPattern + "/", urlPath)) {
- matchingPatterns.add(registeredPattern +"/");
+ matchingPatterns.add(registeredPattern + "/");
}
}
}
@@ -271,7 +271,9 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
* @param request the request to expose the path to
* @see #PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
*/
- protected void exposePathWithinMapping(String bestMatchingPattern, String pathWithinMapping, HttpServletRequest request) {
+ protected void exposePathWithinMapping(String bestMatchingPattern, String pathWithinMapping,
+ HttpServletRequest request) {
+
request.setAttribute(BEST_MATCHING_PATTERN_ATTRIBUTE, bestMatchingPattern);
request.setAttribute(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, pathWithinMapping);
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java
index 238ad765..dcf1125e 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -65,11 +65,11 @@ public class HandlerExceptionResolverComposite implements HandlerExceptionResolv
/**
* Resolve the exception by iterating over the list of configured exception resolvers.
- * The first one to return a ModelAndView instance wins. Otherwise {@code null} is returned.
+ * <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null} is returned.
*/
@Override
- public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response,
- Object handler,Exception ex) {
+ public ModelAndView resolveException(
+ HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
if (this.resolvers != null) {
for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
index 26fb5641..1c1ba726 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -28,16 +28,39 @@ import java.util.Iterator;
*/
public abstract class AbstractRequestCondition<T extends AbstractRequestCondition<T>> implements RequestCondition<T> {
+ /**
+ * Indicates whether this condition is empty, i.e. whether or not it
+ * contains any discrete items.
+ * @return {@code true} if empty; {@code false} otherwise
+ */
+ public boolean isEmpty() {
+ return getContent().isEmpty();
+ }
+
+ /**
+ * Return the discrete items a request condition is composed of.
+ * <p>For example URL patterns, HTTP request methods, param expressions, etc.
+ * @return a collection of objects (never {@code null})
+ */
+ protected abstract Collection<?> getContent();
+
+ /**
+ * The notation to use when printing discrete items of content.
+ * <p>For example {@code " || "} for URL patterns or {@code " && "}
+ * for param expressions.
+ */
+ protected abstract String getToStringInfix();
+
+
@Override
- public boolean equals(Object obj) {
- if (this == obj) {
+ public boolean equals(Object other) {
+ if (this == other) {
return true;
}
- if (obj != null && getClass() == obj.getClass()) {
- AbstractRequestCondition<?> other = (AbstractRequestCondition<?>) obj;
- return getContent().equals(other.getContent());
+ if (other == null || getClass() != other.getClass()) {
+ return false;
}
- return false;
+ return getContent().equals(((AbstractRequestCondition<?>) other).getContent());
}
@Override
@@ -59,28 +82,4 @@ public abstract class AbstractRequestCondition<T extends AbstractRequestConditio
return builder.toString();
}
- /**
- * Indicates whether this condition is empty, i.e. whether or not it
- * contains any discrete items.
- * @return {@code true} if empty; {@code false} otherwise
- */
- public boolean isEmpty() {
- return getContent().isEmpty();
- }
-
-
- /**
- * Return the discrete items a request condition is composed of.
- * <p>For example URL patterns, HTTP request methods, param expressions, etc.
- * @return a collection of objects, never {@code null}
- */
- protected abstract Collection<?> getContent();
-
- /**
- * The notation to use when printing discrete items of content.
- * <p>For example {@code " || "} for URL patterns or {@code " && "}
- * for param expressions.
- */
- protected abstract String getToStringInfix();
-
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java
index 43f5b496..d800d0c9 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2015 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -179,8 +179,8 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
else {
result.add("");
}
- return new PatternsRequestCondition(result, this.pathHelper, this.pathMatcher, this.useSuffixPatternMatch,
- this.useTrailingSlashMatch, this.fileExtensions);
+ return new PatternsRequestCondition(result, this.pathHelper, this.pathMatcher,
+ this.useSuffixPatternMatch, this.useTrailingSlashMatch, this.fileExtensions);
}
/**
@@ -201,17 +201,14 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
*/
@Override
public PatternsRequestCondition getMatchingCondition(HttpServletRequest request) {
-
if (this.patterns.isEmpty()) {
return this;
}
-
String lookupPath = this.pathHelper.getLookupPathForRequest(request);
List<String> matches = getMatchingPatterns(lookupPath);
-
- return matches.isEmpty() ? null :
- new PatternsRequestCondition(matches, this.pathHelper, this.pathMatcher, this.useSuffixPatternMatch,
- this.useTrailingSlashMatch, this.fileExtensions);
+ return (!matches.isEmpty() ?
+ new PatternsRequestCondition(matches, this.pathHelper, this.pathMatcher,
+ this.useSuffixPatternMatch, this.useTrailingSlashMatch, this.fileExtensions) : null);
}
/**
@@ -259,7 +256,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
}
if (this.useTrailingSlashMatch) {
if (!pattern.endsWith("/") && this.pathMatcher.match(pattern + "/", lookupPath)) {
- return pattern +"/";
+ return pattern + "/";
}
}
return null;
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java
index 4fe3ea65..982bebbc 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -46,7 +46,7 @@ public class RequestMappingInfoHandlerMethodMappingNamingStrategy
}
StringBuilder sb = new StringBuilder();
String simpleTypeName = handlerMethod.getBeanType().getSimpleName();
- for (int i = 0 ; i < simpleTypeName.length(); i++) {
+ for (int i = 0; i < simpleTypeName.length(); i++) {
if (Character.isUpperCase(simpleTypeName.charAt(i))) {
sb.append(simpleTypeName.charAt(i));
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
index 57be99d1..e1c2cef2 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -117,7 +117,7 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
* resolution use {@link #setArgumentResolvers} instead.
*/
public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
- this.customArgumentResolvers= argumentResolvers;
+ this.customArgumentResolvers = argumentResolvers;
}
/**
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java
index 7c7d0811..38a1bd27 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -53,7 +53,7 @@ public class SessionAttributeMethodArgumentResolver extends AbstractNamedValueMe
@Override
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletException {
throw new ServletRequestBindingException("Missing session attribute '" + name +
- "' of type " + parameter.getNestedParameterType().getSimpleName());
+ "' of type " + parameter.getNestedParameterType().getSimpleName());
}
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java
index d9d8abd2..2d8b4fce 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -52,7 +52,7 @@ public class ViewMethodReturnValueHandler implements HandlerMethodReturnValueHan
if (returnValue == null) {
return;
}
- else if (returnValue instanceof View){
+ else if (returnValue instanceof View) {
View view = (View) returnValue;
mavContainer.setView(view);
if (view instanceof SmartView) {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java
index 9601ce60..ca846f90 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2015 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -32,10 +32,10 @@ import org.springframework.web.servlet.RequestToViewNameTranslator;
* as the actual return value is left as-is allowing the configured
* {@link RequestToViewNameTranslator} to select a view name by convention.
*
- * <p>A String return value can be interpreted in more than one ways depending
- * on the presence of annotations like {@code @ModelAttribute} or
- * {@code @ResponseBody}. Therefore this handler should be configured after
- * the handlers that support these annotations.
+ * <p>A String return value can be interpreted in more than one ways depending on
+ * the presence of annotations like {@code @ModelAttribute} or {@code @ResponseBody}.
+ * Therefore this handler should be configured after the handlers that support these
+ * annotations.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
@@ -47,12 +47,10 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
/**
- * Configure one more simple patterns (as described in
- * {@link PatternMatchUtils#simpleMatch}) to use in order to recognize
- * custom redirect prefixes in addition to "redirect:".
- * <p>Note that simply configuring this property will not make a custom
- * redirect prefix work. There must be a custom View that recognizes the
- * prefix as well.
+ * Configure one more simple patterns (as described in {@link PatternMatchUtils#simpleMatch})
+ * to use in order to recognize custom redirect prefixes in addition to "redirect:".
+ * <p>Note that simply configuring this property will not make a custom redirect prefix work.
+ * There must be a custom View that recognizes the prefix as well.
* @since 4.1
*/
public void setRedirectPatterns(String... redirectPatterns) {
@@ -84,7 +82,7 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
mavContainer.setRedirectModelScenario(true);
}
}
- else if (returnValue != null){
+ else if (returnValue != null) {
// should not happen
throw new UnsupportedOperationException("Unexpected return type: " +
returnType.getParameterType().getName() + " in method: " + returnType.getMethod());