From c9a86e1ff438368f630107baea637a0b1e4f262e Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 22 Mar 2019 14:39:21 -0400 Subject: [PATCH] Polish See gh-22598 --- .../springframework/http/ReadOnlyHttpHeaders.java | 6 ++++-- .../result/condition/ConsumesRequestCondition.java | 6 +++--- .../result/condition/ProducesRequestCondition.java | 9 ++------- .../reactive/result/method/RequestMappingInfo.java | 12 ++++++------ .../mvc/condition/ConsumesRequestCondition.java | 6 +++--- .../mvc/condition/ProducesRequestCondition.java | 9 ++------- .../web/servlet/mvc/method/RequestMappingInfo.java | 10 +++++----- 7 files changed, 25 insertions(+), 33 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java b/spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java index 6fe96f08196..c3dedaa241b 100644 --- a/spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java +++ b/spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,12 +41,14 @@ class ReadOnlyHttpHeaders extends HttpHeaders { private MediaType cachedContentType; @Nullable - private MediaType cachedAccept; + private List cachedAccept; + ReadOnlyHttpHeaders(HttpHeaders headers) { super(headers.headers); } + @Override public MediaType getContentType() { if (this.cachedContentType != null) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java index f41bad10245..815b2b844bd 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ import org.springframework.web.server.UnsupportedMediaTypeStatusException; */ public final class ConsumesRequestCondition extends AbstractRequestCondition { - private static final ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition(); + private static final ConsumesRequestCondition EMPTY_CONDITION = new ConsumesRequestCondition(); private final List expressions; @@ -161,7 +161,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition { - private static final ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition(); - private static final ProducesRequestCondition EMPTY_CONDITION = new ProducesRequestCondition(); @@ -187,11 +185,8 @@ public final class ProducesRequestCondition extends AbstractRequestCondition result = new LinkedHashSet<>(this.expressions); result.removeIf(expression -> !expression.match(exchange)); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java index 479fcbed15c..ae9dfc3d5d2 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,10 +227,7 @@ public final class RequestMappingInfo implements RequestCondition { - private static final ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition(); + private static final ConsumesRequestCondition EMPTY_CONDITION = new ConsumesRequestCondition(); private final List expressions; @@ -163,7 +163,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition { - private static final ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition(); - private static final ProducesRequestCondition EMPTY_CONDITION = new ProducesRequestCondition(); private static final List MEDIA_TYPE_ALL_LIST = @@ -187,11 +185,8 @@ public final class ProducesRequestCondition extends AbstractRequestCondition acceptedMediaTypes; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java index 537af70221c..70eb0e57b7c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -228,10 +228,6 @@ public final class RequestMappingInfo implements RequestCondition