From ff46cec58fc1c38379120f2339342cab2fe4f2a2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 29 Jul 2015 12:40:35 +0200 Subject: [PATCH] Polishing --- .../condition/PatternsRequestCondition.java | 7 +- .../mvc/method/RequestMappingInfo.java | 49 +++--- .../RequestMappingHandlerMapping.java | 11 +- .../web/servlet/config/spring-mvc-4.2.xsd | 152 +++++++++--------- 4 files changed, 109 insertions(+), 110 deletions(-) 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 4ccd60391ec..43f5b496149 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-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. @@ -103,8 +103,8 @@ public final class PatternsRequestCondition extends AbstractRequestCondition fileExtensions) { this.patterns = Collections.unmodifiableSet(prependLeadingSlash(patterns)); - this.pathHelper = urlPathHelper != null ? urlPathHelper : new UrlPathHelper(); - this.pathMatcher = pathMatcher != null ? pathMatcher : new AntPathMatcher(); + this.pathHelper = (urlPathHelper != null ? urlPathHelper : new UrlPathHelper()); + this.pathMatcher = (pathMatcher != null ? pathMatcher : new AntPathMatcher()); this.useSuffixPatternMatch = useSuffixPatternMatch; this.useTrailingSlashMatch = useTrailingSlashMatch; if (fileExtensions != null) { @@ -220,7 +220,6 @@ public final class PatternsRequestCondition extends AbstractRequestCondition - *
  • {@link PatternsRequestCondition} - *
  • {@link RequestMethodsRequestCondition} - *
  • {@link ParamsRequestCondition} - *
  • {@link HeadersRequestCondition} - *
  • {@link ConsumesRequestCondition} - *
  • {@link ProducesRequestCondition} - *
  • {@code RequestCondition} (optional, custom request condition) + *
  • {@link PatternsRequestCondition} + *
  • {@link RequestMethodsRequestCondition} + *
  • {@link ParamsRequestCondition} + *
  • {@link HeadersRequestCondition} + *
  • {@link ConsumesRequestCondition} + *
  • {@link ProducesRequestCondition} + *
  • {@code RequestCondition} (optional, custom request condition) * * * @author Arjen Poutsma @@ -297,21 +296,21 @@ public final class RequestMappingInfo implements RequestConditionBy default this is not set. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java index 1989025616c..a5252faffcb 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java @@ -122,7 +122,6 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi @Override public void afterPropertiesSet() { - this.config = new RequestMappingInfo.BuilderConfiguration(); this.config.setPathHelper(getUrlPathHelper()); this.config.setPathMatcher(getPathMatcher()); @@ -204,15 +203,13 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi * Delegates to {@link #createRequestMappingInfo(RequestMapping, RequestCondition)}, * supplying the appropriate custom {@link RequestCondition} depending on whether * the supplied {@code annotatedElement} is a class or method. - * * @see #getCustomTypeCondition(Class) * @see #getCustomMethodCondition(Method) */ private RequestMappingInfo createRequestMappingInfo(AnnotatedElement element) { RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(element, RequestMapping.class); RequestCondition condition = (element instanceof Class ? - getCustomTypeCondition((Class) element) : - getCustomMethodCondition((Method) element)); + getCustomTypeCondition((Class) element) : getCustomMethodCondition((Method) element)); return (requestMapping != null ? createRequestMappingInfo(requestMapping, condition) : null); } @@ -252,8 +249,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi * a directly declared annotation, a meta-annotation, or the synthesized * result of merging annotation attributes within an annotation hierarchy. */ - protected RequestMappingInfo createRequestMappingInfo(RequestMapping requestMapping, - RequestCondition customCondition) { + protected RequestMappingInfo createRequestMappingInfo( + RequestMapping requestMapping, RequestCondition customCondition) { return RequestMappingInfo .paths(resolveEmbeddedValuesInPatterns(requestMapping.path())) @@ -348,7 +345,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi + "or an empty string (\"\"); current value is [" + allowCredentials + "]."); } - if ((annotation.maxAge() >= 0) && (config.getMaxAge() == null)) { + if (annotation.maxAge() >= 0 && config.getMaxAge() == null) { config.setMaxAge(annotation.maxAge()); } } diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.2.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.2.xsd index a424c3da9e9..4f85089263b 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.2.xsd +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.2.xsd @@ -13,7 +13,7 @@ - @@ -111,7 +111,8 @@ @@ -141,7 +142,7 @@ ]]> - + @@ -173,7 +174,7 @@ ]]> - + @@ -237,7 +238,7 @@ ]]> - + @@ -246,8 +247,9 @@ @@ -258,13 +260,12 @@ - + @@ -273,12 +274,12 @@ - + @@ -286,15 +287,15 @@ - + @@ -308,7 +309,7 @@ ]]> - + @@ -328,9 +329,10 @@ @@ -345,7 +347,7 @@ to the file name, e.g. "styles/main-e36d2e05253c6c7085a91522ce43a0b4.css". ]]> - + @@ -355,8 +357,8 @@ e.g. reduced SHA, version name, release date, etc. ]]> - - + + @@ -381,7 +383,7 @@ - + @@ -393,9 +395,9 @@ ]]> - - - + + + @@ -403,13 +405,13 @@ - + @@ -602,7 +605,8 @@ @@ -633,7 +637,8 @@ @@ -644,22 +649,23 @@ @@ -671,7 +677,7 @@ - + @@ -947,7 +953,7 @@ ]]> - + @@ -1285,67 +1291,67 @@