1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .web .cors .reactive ;
18
18
19
19
import java .util .ArrayList ;
20
- import java .util .Arrays ;
21
20
import java .util .List ;
22
21
23
22
import org .apache .commons .logging .Log ;
37
36
* The default implementation of {@link CorsProcessor},
38
37
* as defined by the <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>.
39
38
*
40
- * <p>Note that when input {@link CorsConfiguration} is {@code null}, this
39
+ * <p>Note that when the supplied {@link CorsConfiguration} is {@code null}, this
41
40
* implementation does not reject simple or actual requests outright but simply
42
- * avoid adding CORS headers to the response. CORS processing is also skipped
41
+ * avoids adding CORS headers to the response. CORS processing is also skipped
43
42
* if the response already contains CORS headers.
44
43
*
45
44
* @author Sebastien Deleuze
@@ -50,13 +49,12 @@ public class DefaultCorsProcessor implements CorsProcessor {
50
49
51
50
private static final Log logger = LogFactory .getLog (DefaultCorsProcessor .class );
52
51
53
- private static final List <String > VARY_HEADERS = Arrays . asList (
52
+ private static final List <String > VARY_HEADERS = List . of (
54
53
HttpHeaders .ORIGIN , HttpHeaders .ACCESS_CONTROL_REQUEST_METHOD , HttpHeaders .ACCESS_CONTROL_REQUEST_HEADERS );
55
54
56
55
57
56
@ Override
58
57
public boolean process (@ Nullable CorsConfiguration config , ServerWebExchange exchange ) {
59
-
60
58
ServerHttpRequest request = exchange .getRequest ();
61
59
ServerHttpResponse response = exchange .getResponse ();
62
60
HttpHeaders responseHeaders = response .getHeaders ();
0 commit comments