diff --git a/build.gradle b/build.gradle index 55759453315..ed365e64210 100644 --- a/build.gradle +++ b/build.gradle @@ -726,6 +726,7 @@ project("spring-webmvc-tiles3") { } optional("org.apache.tiles:tiles-extras:3.0.1") { exclude group: "org.slf4j", module: "jcl-over-slf4j" + exclude group: "org.springframework", module: "spring-web" } optional("org.apache.tiles:tiles-el:3.0.1") { exclude group: "org.slf4j", module: "jcl-over-slf4j" diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/PathVariable.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/PathVariable.java index df22081b694..a3b4aec9240 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/PathVariable.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/PathVariable.java @@ -24,17 +24,17 @@ import java.lang.annotation.Target; /** * Annotation that indicates a method parameter should be bound to a path template - * variable. Supported on message handling methods such as {@link MessageMapping - * @MessageMapping} for messages with path-like destination semantics. - *
- * A {@code @PathVariable} template variable is always required and does not have a + * variable. Supported on message handling methods such as + * {@link MessageMapping @MessageMapping} for messages with path-like destination + * semantics. + * + *
A {@code @PathVariable} template variable is always required and does not have a * default value to fall back on. * * @author Brian Clozel + * @since 4.0 * @see org.springframework.messaging.handler.annotation.MessageMapping * @see org.springframework.messaging.simp.handler.SimpAnnotationMethodMessageHandler - * - * @since 4.0 */ @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/PathVariable.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/PathVariable.java index 4a117205233..a61f09ee45e 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/PathVariable.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/PathVariable.java @@ -28,17 +28,19 @@ import java.lang.annotation.Target; * environments. * * @author Arjen Poutsma + * @since 3.0 * @see RequestMapping * @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter * @see org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter - * @since 3.0 */ @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface PathVariable { - /** The URI template variable to bind to. */ + /** + * The URI template variable to bind to. + */ String value() default ""; } diff --git a/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java b/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java index fe530ff35f6..05fce62b090 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java +++ b/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java @@ -248,7 +248,7 @@ public class UriComponentsBuilder { throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL"); } } - + // build methods @@ -398,7 +398,7 @@ public class UriComponentsBuilder { } return this; } - + /** * Set the URI scheme-specific-part. When invoked, this method overwrites * {@linkplain #userInfo(String) user-info}, {@linkplain #host(String) host}, diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultMvcUrls.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultMvcUrls.java index f5749619d5d..1b4784d2639 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultMvcUrls.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultMvcUrls.java @@ -63,10 +63,9 @@ public class DefaultMvcUrls implements MvcUrls { * {@link HandlerMethodArgumentResolver}s. Since both of these tend to be implemented * by the same class, the most convenient option is to obtain the configured * {@code HandlerMethodArgumentResolvers} in the {@code RequestMappingHandlerAdapter} - * and provide that to this contstructor. - * + * and provide that to this constructor. * @param uriComponentsContributors a collection of {@link UriComponentsContributor} - * or {@link HandlerMethodArgumentResolver}s. + * or {@link HandlerMethodArgumentResolver}s. */ public DefaultMvcUrls(Collection> uriComponentsContributors) { this(uriComponentsContributors, null); @@ -77,26 +76,22 @@ public class DefaultMvcUrls implements MvcUrls { * {@link HandlerMethodArgumentResolver}s. Since both of these tend to be implemented * by the same class, the most convenient option is to obtain the configured * {@code HandlerMethodArgumentResolvers} in the {@code RequestMappingHandlerAdapter} - * and provide that to this contstructor. - *
- * If the {@link ConversionService} argument is {@code null}, - * {@link DefaultFormattingConversionService} will be used by default. + * and provide that to this constructor. * + *
If the {@link ConversionService} argument is {@code null},
+ * {@link DefaultFormattingConversionService} will be used by default.
* @param uriComponentsContributors a collection of {@link UriComponentsContributor}
- * or {@link HandlerMethodArgumentResolver}s.
+ * or {@link HandlerMethodArgumentResolver}s.
* @param conversionService a ConversionService to use when method argument values
- * need to be formatted as Strings before being added to the URI
+ * need to be formatted as Strings before being added to the URI
*/
public DefaultMvcUrls(Collection> uriComponentsContributors, ConversionService conversionService) {
-
Assert.notNull(uriComponentsContributors, "'uriComponentsContributors' must not be null");
-
for (Object contributor : uriComponentsContributors) {
if (contributor instanceof UriComponentsContributor) {
this.contributors.add((UriComponentsContributor) contributor);
}
}
-
this.conversionService = (conversionService != null) ?
conversionService : new DefaultFormattingConversionService();
}
@@ -118,14 +113,12 @@ public class DefaultMvcUrls implements MvcUrls {
private UriComponents applyContributers(UriComponentsBuilder builder, Method method,
Object[] argumentValues, Map
* Instances of this interface are returned from
* {@link MvcUrlUtils#controller(Class, Object...) controller(Class, Object...)} and
- * are needed for {@link MvcUrls#linkToMethodOn(ControllerMethodValues)}.
+ * are needed for {@link MvcUrls#linkToMethodOn(Object)}.
*/
public interface ControllerMethodValues {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/MvcUrls.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/MvcUrls.java
index 23bc4aa0114..3f42ed9ff35 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/MvcUrls.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/MvcUrls.java
@@ -27,19 +27,18 @@ import org.springframework.web.util.UriComponentsBuilder;
/**
* A contract for creating URLs by referencing Spring MVC controllers and methods.
- *
- * The MVC Java config and the MVC namespace automatically create an instance of this
+ *
+ * The MVC Java config and the MVC namespace automatically create an instance of this
* contract for use in controllers and anywhere else during the processing of a request.
* The best way for access it is to have it autowired, or otherwise injected either by
* type or also qualified by name ("mvcUrls") if necessary.
- *
- * If not using either option, with explicit configuration it's easy to create an instance
- * of {@link DefaultMvcUrls} in Java config or in XML configuration, use
+ *
+ * If not using either option, with explicit configuration it's easy to create an
+ * instance of {@link DefaultMvcUrls} in Java config or in XML configuration, use
* {@link DefaultMvcUrlsFactoryBean}.
*
* @author Oliver Gierke
* @author Rossen Stoyanchev
- *
* @since 4.0
*/
public interface MvcUrls {
@@ -50,9 +49,7 @@ public interface MvcUrls {
* the Servlet mapping as well as the portion of the path matching to the controller
* level request mapping. If the controller contains multiple mappings, the
* {@link DefaultMvcUrls} will use the first one.
- *
* @param controllerType the controller type to create a URL to
- *
* @return a builder that can be used to further build the {@link UriComponents}.
*/
UriComponentsBuilder linkToController(Class> controllerType);
@@ -60,19 +57,15 @@ public interface MvcUrls {
/**
* Create a {@link UriComponents} by pointing to a controller method along with method
* argument values.
- *
- * Type and method-level mappings of the controller method are extracted and the
+ *
+ * Type and method-level mappings of the controller method are extracted and the
* resulting {@link UriComponents} is further enriched with method argument values from
* {@link PathVariable} and {@link RequestParam} parameters. Any other arguments not
* relevant to the building of the URL can be provided as {@literal null} and will be
* ignored. Support for additional custom arguments can be added through a
* {@link UriComponentsContributor}.
- *
- * FIXME Type-level URI template variables?
- *
* @param method the target controller method
* @param argumentValues argument values matching to method parameters
- *
* @return UriComponents instance, never {@literal null}
*/
UriComponents linkToMethod(Method method, Object... argumentValues);
@@ -88,10 +81,10 @@ public interface MvcUrls {
* class AddressController {
*
* @RequestMapping("/{country}")
- * public HttpEntity