Fix new Sonar smells
* Some code clean up in the affected classes
This commit is contained in:
@@ -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 <code>byte[].class</code>.
|
||||
* 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 <code>byte[].class</code>.
|
||||
* 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user