Remove trailing whitespace in Java source code
This commit is contained in:
@@ -26,19 +26,19 @@ import org.springframework.web.cors.CorsConfiguration;
|
||||
/**
|
||||
* Assist with the registration of {@link CorsConfiguration} mapped to one or more path patterns.
|
||||
* @author Sebastien Deleuze
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
* @see CorsRegistration
|
||||
*/
|
||||
public class CorsConfigurer {
|
||||
|
||||
|
||||
private final List<CorsRegistration> registrations = new ArrayList<CorsRegistration>();
|
||||
|
||||
|
||||
/**
|
||||
* Enable cross origin requests on the specified path patterns. If no path pattern is specified,
|
||||
* cross-origin request handling is mapped on "/**" .
|
||||
*
|
||||
*
|
||||
* <p>By default, all origins, all headers and credentials are allowed. Max age is set to 30 minutes.</p>
|
||||
*/
|
||||
public CorsRegistration enableCors(String... pathPatterns) {
|
||||
@@ -46,7 +46,7 @@ public class CorsConfigurer {
|
||||
this.registrations.add(registration);
|
||||
return registration;
|
||||
}
|
||||
|
||||
|
||||
protected Map<String, CorsConfiguration> getCorsConfigurations() {
|
||||
Map<String, CorsConfiguration> configs = new LinkedHashMap<String, CorsConfiguration>(this.registrations.size());
|
||||
for (CorsRegistration registration : this.registrations) {
|
||||
|
||||
@@ -25,19 +25,19 @@ import org.springframework.web.cors.CorsConfiguration;
|
||||
/**
|
||||
* Assists with the creation of a {@link CorsConfiguration} mapped to one or more path patterns.
|
||||
* If no path pattern is specified, cross-origin request handling is mapped on "/**" .
|
||||
*
|
||||
*
|
||||
* <p>By default, all origins, all headers, credentials and GET, HEAD, POST methods are allowed.
|
||||
* Max age is set to 30 minutes.</p>
|
||||
*
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.2
|
||||
*/
|
||||
public class CorsRegistration {
|
||||
|
||||
|
||||
private final String[] pathPatterns;
|
||||
|
||||
|
||||
private final CorsConfiguration config;
|
||||
|
||||
|
||||
public CorsRegistration(String... pathPatterns) {
|
||||
this.pathPatterns = (pathPatterns.length == 0 ? new String[]{ "/**" } : pathPatterns);
|
||||
// Same default values than @CrossOrigin annotation + allows simple methods
|
||||
@@ -50,43 +50,43 @@ public class CorsRegistration {
|
||||
this.config.setAllowCredentials(true);
|
||||
this.config.setMaxAge(1800L);
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration allowedOrigins(String... origins) {
|
||||
this.config.setAllowedOrigins(new ArrayList<String>(Arrays.asList(origins)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration allowedMethods(String... methods) {
|
||||
this.config.setAllowedMethods(new ArrayList<String>(Arrays.asList(methods)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration allowedHeaders(String... headers) {
|
||||
this.config.setAllowedHeaders(new ArrayList<String>(Arrays.asList(headers)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration exposedHeaders(String... headers) {
|
||||
this.config.setExposedHeaders(new ArrayList<String>(Arrays.asList(headers)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration maxAge(long maxAge) {
|
||||
this.config.setMaxAge(maxAge);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public CorsRegistration allowCredentials(boolean allowCredentials) {
|
||||
this.config.setAllowCredentials(allowCredentials);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
protected String[] getPathPatterns() {
|
||||
return this.pathPatterns;
|
||||
}
|
||||
|
||||
|
||||
protected CorsConfiguration getCorsConfiguration() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -136,5 +136,5 @@ public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
protected void configureCors(CorsConfigurer configurer) {
|
||||
this.configurers.configureCors(configurer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
private ContentNegotiationManager contentNegotiationManager;
|
||||
|
||||
private List<HttpMessageConverter<?>> messageConverters;
|
||||
|
||||
|
||||
private Map<String, CorsConfiguration> corsConfigurations;
|
||||
|
||||
|
||||
@@ -881,7 +881,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
}
|
||||
return this.corsConfigurations;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override this method to configure cross-origin requests handling.
|
||||
* @since 4.2
|
||||
|
||||
@@ -172,5 +172,5 @@ public abstract class WebMvcConfigurerAdapter implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void configureCors(CorsConfigurer configurer) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||
private final List<HandlerInterceptor> adaptedInterceptors = new ArrayList<HandlerInterceptor>();
|
||||
|
||||
private CorsProcessor corsProcessor = new DefaultCorsProcessor();
|
||||
|
||||
|
||||
private final Map<String, CorsConfiguration> corsConfiguration =
|
||||
new LinkedHashMap<String, CorsConfiguration>();
|
||||
|
||||
|
||||
@@ -678,7 +678,7 @@ public class MvcUriComponentsBuilder {
|
||||
ControllerMethodInvocationInterceptor(Class<?> controllerType) {
|
||||
this.controllerType = controllerType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) {
|
||||
if (getControllerMethod.equals(method)) {
|
||||
|
||||
Reference in New Issue
Block a user