diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java
index a685a82890..f1a7604c33 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java
@@ -36,6 +36,7 @@ import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.integration.http.support.DefaultHttpHeaderMapper;
import org.springframework.integration.http.support.IntegrationWebExchangeBindException;
import org.springframework.integration.mapping.HeaderMapper;
+import org.springframework.lang.Nullable;
import org.springframework.messaging.MessageHeaders;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -190,7 +191,7 @@ public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements
* Specify the type of payload to be generated when the inbound HTTP request
* content is read by the converters/encoders.
* By default this value is null which means at runtime any "text" Content-Type will
- * result in String while all others default to byte[].class.
+ * result in String while all others default to {@code byte[].class}.
* @param requestPayloadType The payload type.
*/
public void setRequestPayloadTypeClass(Class> requestPayloadType) {
@@ -201,7 +202,7 @@ public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements
* Specify the type of payload to be generated when the inbound HTTP request
* content is read by the converters/encoders.
* By default this value is null which means at runtime any "text" Content-Type will
- * result in String while all others default to byte[].class.
+ * result in String while all others default to {@code byte[].class}.
* @param requestPayloadType The payload type.
*/
public void setRequestPayloadType(ResolvableType requestPayloadType) {
@@ -350,15 +351,6 @@ public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements
return this.expectReply ? super.getIntegrationPatternType() : IntegrationPatternType.inbound_channel_adapter;
}
- /**
- * Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).
- * @param httpMethod the HTTP method to check
- * @return true or false if HTTP request can contain the body
- */
- protected boolean isReadable(HttpMethod httpMethod) {
- return !(CollectionUtils.containsInstance(NON_READABLE_BODY_HTTP_METHODS, httpMethod));
- }
-
protected void validate(Object value) {
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(value, "requestPayload");
ValidationUtils.invokeValidator(this.validator, value, errors);
@@ -367,4 +359,13 @@ public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements
}
}
+ /**
+ * Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).
+ * @param httpMethod the HTTP method to check
+ * @return true or false if HTTP request can contain the body
+ */
+ protected static boolean isReadable(@Nullable HttpMethod httpMethod) {
+ return !(CollectionUtils.containsInstance(NON_READABLE_BODY_HTTP_METHODS, httpMethod));
+ }
+
}
diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java
index 783c8be87c..85894ad729 100644
--- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java
+++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java
@@ -68,10 +68,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
*/
public void setParameters(List parameters) {
Assert.notEmpty(parameters, "parameters must not be null or empty.");
-
- for (JpaParameter parameter : parameters) {
- Assert.notNull(parameter, "The provided list (parameters) cannot contain null values.");
- }
+ Assert.noNullElements(parameters, "The provided list (parameters) cannot contain null values.");
this.parameters.addAll(parameters);
this.expressionEvaluator.getEvaluationContext().setVariable("staticParameters",
@@ -108,12 +105,11 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
this.parametersMap.put(parameter.getName(), parameter);
}
this.values.putAll(ExpressionEvaluatingParameterSourceUtils.convertStaticParameters(parameters));
-
}
@Override
+ @Nullable
public Object getValueByPosition(int position) {
-
Assert.isTrue(position >= 0, "The position must be non-negative.");
if (position <= this.parameters.size()) {
@@ -148,10 +144,10 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
}
return null;
-
}
@Override
+ @Nullable
public Object getValue(String paramName) {
if (this.values.containsKey(paramName)) {
return this.values.get(paramName);
diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java
index 3dcb5475a5..40015fd6b8 100644
--- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java
+++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java
@@ -167,13 +167,14 @@ public class WebFluxInboundEndpoint extends BaseHttpInboundEndpoint implements W
}
private Mono> extractRequestBody(ServerWebExchange exchange) {
- if (isReadable(exchange.getRequest().getMethod())) {
+ ServerHttpRequest request = exchange.getRequest();
+ if (isReadable(request.getMethod())) {
return extractReadableRequestBody(exchange)
.cast(Object.class)
- .switchIfEmpty(queryParams(exchange));
+ .switchIfEmpty(queryParams(request));
}
else {
- return queryParams(exchange);
+ return queryParams(request);
}
}
@@ -515,8 +516,8 @@ public class WebFluxInboundEndpoint extends BaseHttpInboundEndpoint implements W
return (mediaTypes != null ? new ArrayList<>(mediaTypes) : producibleTypesSupplier.get());
}
- private static Mono> queryParams(ServerWebExchange exchange) {
- return Mono.just(exchange.getRequest().getQueryParams());
+ private static Mono> queryParams(ServerHttpRequest request) {
+ return Mono.just(request.getQueryParams());
}
private static MediaType selectMoreSpecificMediaType(MediaType acceptable, MediaType producible) {