Skip to content

Commit aac0e63

Browse files
committed
Various @SInCE tags (and varargs on setInterceptors)
1 parent 96f1a0e commit aac0e63

File tree

4 files changed

+54
-41
lines changed

4 files changed

+54
-41
lines changed

spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ protected UriComponentsBuilder() {
124124
/**
125125
* Create a deep copy of the given UriComponentsBuilder.
126126
* @param other the other builder to copy from
127+
* @since 4.1.3
127128
*/
128129
protected UriComponentsBuilder(UriComponentsBuilder other) {
129130
this.scheme = other.scheme;
@@ -603,6 +604,7 @@ public UriComponentsBuilder queryParam(String name, Object... values) {
603604
* Add the given query parameters.
604605
* @param params the params
605606
* @return this UriComponentsBuilder
607+
* @since 4.0
606608
*/
607609
public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
608610
if (params != null) {
@@ -632,6 +634,7 @@ public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
632634
* Set the query parameter values overriding all existing query values.
633635
* @param params the query parameter name
634636
* @return this UriComponentsBuilder
637+
* @since 4.2
635638
*/
636639
public UriComponentsBuilder replaceQueryParams(MultiValueMap<String, String> params) {
637640
this.queryParams.clear();

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
213213
this.applicationContext = applicationContext;
214214
}
215215

216+
/**
217+
* Return the associated Spring {@link ApplicationContext}.
218+
* @since 4.2
219+
*/
216220
public ApplicationContext getApplicationContext() {
217221
return this.applicationContext;
218222
}
@@ -226,6 +230,10 @@ public void setServletContext(ServletContext servletContext) {
226230
this.servletContext = servletContext;
227231
}
228232

233+
/**
234+
* Return the associated {@link javax.servlet.ServletContext}.
235+
* @since 4.2
236+
*/
229237
public ServletContext getServletContext() {
230238
return this.servletContext;
231239
}
@@ -268,6 +276,7 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
268276
/**
269277
* Protected method for plugging in a custom subclass of
270278
* {@link RequestMappingHandlerMapping}.
279+
* @since 4.0
271280
*/
272281
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
273282
return new RequestMappingHandlerMapping();
@@ -318,6 +327,32 @@ protected PathMatchConfigurer getPathMatchConfigurer() {
318327
public void configurePathMatch(PathMatchConfigurer configurer) {
319328
}
320329

330+
/**
331+
* Return a global {@link PathMatcher} instance for path matching
332+
* patterns in {@link HandlerMapping}s.
333+
* This instance can be configured using the {@link PathMatchConfigurer}
334+
* in {@link #configurePathMatch(PathMatchConfigurer)}.
335+
* @since 4.1
336+
*/
337+
@Bean
338+
public PathMatcher mvcPathMatcher() {
339+
PathMatcher pathMatcher = getPathMatchConfigurer().getPathMatcher();
340+
return (pathMatcher != null ? pathMatcher : new AntPathMatcher());
341+
}
342+
343+
/**
344+
* Return a global {@link UrlPathHelper} instance for path matching
345+
* patterns in {@link HandlerMapping}s.
346+
* This instance can be configured using the {@link PathMatchConfigurer}
347+
* in {@link #configurePathMatch(PathMatchConfigurer)}.
348+
* @since 4.1
349+
*/
350+
@Bean
351+
public UrlPathHelper mvcUrlPathHelper() {
352+
UrlPathHelper pathHelper = getPathMatchConfigurer().getUrlPathHelper();
353+
return (pathHelper != null ? pathHelper : new UrlPathHelper());
354+
}
355+
321356
/**
322357
* Return a {@link ContentNegotiationManager} instance to use to determine
323358
* requested {@linkplain MediaType media types} in a given request.
@@ -414,8 +449,7 @@ public HandlerMapping resourceHandlerMapping() {
414449
if (handlerMapping != null) {
415450
handlerMapping.setPathMatcher(mvcPathMatcher());
416451
handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
417-
handlerMapping.setInterceptors(new HandlerInterceptor[] {
418-
new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider())});
452+
handlerMapping.setInterceptors(new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider()));
419453
handlerMapping.setCorsConfigurations(getCorsConfigurations());
420454
}
421455
else {
@@ -431,6 +465,10 @@ public HandlerMapping resourceHandlerMapping() {
431465
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
432466
}
433467

468+
/**
469+
* A {@link ResourceUrlProvider} bean for use with the MVC dispatcher.
470+
* @since 4.1
471+
*/
434472
@Bean
435473
public ResourceUrlProvider mvcResourceUrlProvider() {
436474
ResourceUrlProvider urlProvider = new ResourceUrlProvider();
@@ -596,36 +634,6 @@ protected Validator getValidator() {
596634
return null;
597635
}
598636

599-
/**
600-
* Return a global {@link PathMatcher} instance for path matching
601-
* patterns in {@link HandlerMapping}s.
602-
* This instance can be configured using the {@link PathMatchConfigurer}
603-
* in {@link #configurePathMatch(PathMatchConfigurer)}.
604-
* @since 4.1
605-
*/
606-
@Bean
607-
public PathMatcher mvcPathMatcher() {
608-
if (getPathMatchConfigurer().getPathMatcher() != null) {
609-
return getPathMatchConfigurer().getPathMatcher();
610-
}
611-
else {
612-
return new AntPathMatcher();
613-
}
614-
}
615-
616-
/**
617-
* Return a global {@link UrlPathHelper} instance for path matching
618-
* patterns in {@link HandlerMapping}s.
619-
* This instance can be configured using the {@link PathMatchConfigurer}
620-
* in {@link #configurePathMatch(PathMatchConfigurer)}.
621-
* @since 4.1
622-
*/
623-
@Bean
624-
public UrlPathHelper mvcUrlPathHelper() {
625-
UrlPathHelper pathHelper = getPathMatchConfigurer().getUrlPathHelper();
626-
return (pathHelper != null ? pathHelper : new UrlPathHelper());
627-
}
628-
629637
/**
630638
* Add custom {@link HandlerMethodArgumentResolver}s to use in addition to
631639
* the ones registered by default.
@@ -739,6 +747,7 @@ else if (gsonPresent) {
739747
/**
740748
* Return an instance of {@link CompositeUriComponentsContributor} for use with
741749
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
750+
* @since 4.0
742751
*/
743752
@Bean
744753
public CompositeUriComponentsContributor mvcUriComponentsContributor() {

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public interface WebMvcConfigurer {
149149
* Configure view resolvers to translate String-based view names returned from
150150
* controllers into concrete {@link org.springframework.web.servlet.View}
151151
* implementations to perform rendering with.
152+
* @since 4.1
152153
*/
153154
void configureViewResolvers(ViewResolverRegistry registry);
154155

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -27,21 +27,21 @@
2727
import org.springframework.beans.BeansException;
2828
import org.springframework.beans.factory.BeanFactoryUtils;
2929
import org.springframework.core.Ordered;
30-
import org.springframework.web.HttpRequestHandler;
31-
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
32-
import org.springframework.web.cors.CorsProcessor;
33-
import org.springframework.web.cors.CorsConfiguration;
34-
import org.springframework.web.cors.CorsConfigurationSource;
3530
import org.springframework.util.AntPathMatcher;
3631
import org.springframework.util.Assert;
3732
import org.springframework.util.PathMatcher;
33+
import org.springframework.web.HttpRequestHandler;
3834
import org.springframework.web.context.request.WebRequestInterceptor;
3935
import org.springframework.web.context.support.WebApplicationObjectSupport;
36+
import org.springframework.web.cors.CorsConfiguration;
37+
import org.springframework.web.cors.CorsConfigurationSource;
38+
import org.springframework.web.cors.CorsProcessor;
39+
import org.springframework.web.cors.CorsUtils;
40+
import org.springframework.web.cors.DefaultCorsProcessor;
41+
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
4042
import org.springframework.web.servlet.HandlerExecutionChain;
4143
import org.springframework.web.servlet.HandlerInterceptor;
4244
import org.springframework.web.servlet.HandlerMapping;
43-
import org.springframework.web.cors.DefaultCorsProcessor;
44-
import org.springframework.web.cors.CorsUtils;
4545
import org.springframework.web.util.UrlPathHelper;
4646

4747
/**
@@ -197,7 +197,7 @@ public PathMatcher getPathMatcher() {
197197
* @see org.springframework.web.servlet.HandlerInterceptor
198198
* @see org.springframework.web.context.request.WebRequestInterceptor
199199
*/
200-
public void setInterceptors(Object[] interceptors) {
200+
public void setInterceptors(Object... interceptors) {
201201
this.interceptors.addAll(Arrays.asList(interceptors));
202202
}
203203

0 commit comments

Comments
 (0)