Browse Source

Polish contribution

See gh-26619
pull/27107/head
Sam Brannen 5 years ago
parent
commit
31c5fc6417
  1. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java
  2. 13
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/CrossOriginAnnotationIntegrationTests.java
  3. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java
  4. 12
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/CrossOriginTests.java

2
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

13
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/CrossOriginAnnotationIntegrationTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -38,7 +37,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.reactive.config.EnableWebFlux; import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer; import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
@ -273,6 +271,7 @@ class CrossOriginAnnotationIntegrationTests extends AbstractRequestMappingIntegr
assertThat(entity.getHeaders().getAccessControlMaxAge()).isEqualTo(100); assertThat(entity.getHeaders().getAccessControlMaxAge()).isEqualTo(100);
} }
@Configuration @Configuration
@EnableWebFlux @EnableWebFlux
@ComponentScan(resourcePattern = "**/CrossOriginAnnotationIntegrationTests*") @ComponentScan(resourcePattern = "**/CrossOriginAnnotationIntegrationTests*")
@ -381,14 +380,14 @@ class CrossOriginAnnotationIntegrationTests extends AbstractRequestMappingIntegr
private static class MaxAgeWithDefaultOriginController { private static class MaxAgeWithDefaultOriginController {
@CrossOrigin @CrossOrigin
@GetMapping(path = "/classAge") @GetMapping("/classAge")
public String classAge() { String classAge() {
return "classAge"; return "classAge";
} }
@CrossOrigin(maxAge = 100) @CrossOrigin(maxAge = 100)
@GetMapping(path = "/methodAge") @GetMapping("/methodAge")
public String methodAge() { String methodAge() {
return "methodAge"; return "methodAge";
} }
} }

2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

12
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/CrossOriginTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/** /**
* Test fixture for {@link CrossOrigin @CrossOrigin} annotated methods. * Tests for {@link CrossOrigin @CrossOrigin} annotated methods.
* *
* @author Sebastien Deleuze * @author Sebastien Deleuze
* @author Sam Brannen * @author Sam Brannen
@ -453,13 +453,13 @@ public class CrossOriginTests {
private static class MaxAgeWithDefaultOriginController { private static class MaxAgeWithDefaultOriginController {
@CrossOrigin @CrossOrigin
@RequestMapping(path = "/classAge", method = RequestMethod.GET) @GetMapping("/classAge")
public void classAge() { void classAge() {
} }
@CrossOrigin(maxAge = 100) @CrossOrigin(maxAge = 100)
@RequestMapping(path = "/methodAge", method = RequestMethod.GET) @GetMapping("/methodAge")
public void methodAge() { void methodAge() {
} }
} }

Loading…
Cancel
Save