|
28 | 28 | import org.springframework.http.HttpEntity;
|
29 | 29 | import org.springframework.http.HttpHeaders;
|
30 | 30 | import org.springframework.http.HttpMethod;
|
31 |
| -import org.springframework.http.HttpRequest; |
32 | 31 | import org.springframework.http.HttpStatus;
|
33 | 32 | import org.springframework.integration.context.OrderlyShutdownCapable;
|
34 | 33 | import org.springframework.integration.expression.ExpressionUtils;
|
|
51 | 50 | */
|
52 | 51 | public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements OrderlyShutdownCapable {
|
53 | 52 |
|
54 |
| - protected static final boolean jaxb2Present = // NOSONAR lower case static |
| 53 | + protected static final boolean JAXB_PRESENT = |
55 | 54 | ClassUtils.isPresent("javax.xml.bind.Binder",
|
56 | 55 | BaseHttpInboundEndpoint.class.getClassLoader());
|
57 | 56 |
|
58 |
| - protected static final boolean romeToolsPresent = // NOSONAR lower case static |
| 57 | + protected static final boolean ROME_TOOLS_PRESENT = |
59 | 58 | ClassUtils.isPresent("com.rometools.rome.feed.atom.Feed",
|
60 | 59 | BaseHttpInboundEndpoint.class.getClassLoader());
|
61 | 60 |
|
62 |
| - protected static final List<HttpMethod> nonReadableBodyHttpMethods = // NOSONAR lower case static |
| 61 | + protected static final List<HttpMethod> NON_READABLE_BODY_HTTP_METHODS = |
63 | 62 | Arrays.asList(HttpMethod.GET, HttpMethod.HEAD, HttpMethod.OPTIONS);
|
64 | 63 |
|
65 |
| - protected final boolean expectReply; |
| 64 | + protected final AtomicInteger activeCount = new AtomicInteger(); // NOSONAR |
66 | 65 |
|
67 |
| - protected final AtomicInteger activeCount = new AtomicInteger(); |
| 66 | + private final boolean expectReply; |
68 | 67 |
|
69 | 68 | private ResolvableType requestPayloadType = null;
|
70 | 69 |
|
@@ -268,13 +267,12 @@ protected void onInit() {
|
268 | 267 | }
|
269 | 268 |
|
270 | 269 | private void validateSupportedMethods() {
|
271 |
| - if (this.requestPayloadType != null |
272 |
| - && CollectionUtils.containsAny(nonReadableBodyHttpMethods, |
273 |
| - Arrays.asList(getRequestMapping().getMethods()))) { |
274 |
| - if (logger.isWarnEnabled()) { |
275 |
| - logger.warn("The 'requestPayloadType' attribute will have no relevance for one " + |
276 |
| - "of the specified HTTP methods '" + nonReadableBodyHttpMethods + "'"); |
277 |
| - } |
| 270 | + if (this.requestPayloadType != null && logger.isWarnEnabled() && |
| 271 | + CollectionUtils.containsAny(NON_READABLE_BODY_HTTP_METHODS, |
| 272 | + Arrays.asList(getRequestMapping().getMethods()))) { |
| 273 | + |
| 274 | + logger.warn("The 'requestPayloadType' attribute will have no relevance for one " + |
| 275 | + "of the specified HTTP methods '" + NON_READABLE_BODY_HTTP_METHODS + "'"); |
278 | 276 | }
|
279 | 277 | }
|
280 | 278 |
|
@@ -329,11 +327,11 @@ public String getComponentType() {
|
329 | 327 |
|
330 | 328 | /**
|
331 | 329 | * Checks if the request has a readable body (not a GET, HEAD, or OPTIONS request).
|
332 |
| - * @param request the HTTP request to check the method |
| 330 | + * @param httpMethod the HTTP method to check |
333 | 331 | * @return true or false if HTTP request can contain the body
|
334 | 332 | */
|
335 |
| - protected boolean isReadable(HttpRequest request) { |
336 |
| - return !(CollectionUtils.containsInstance(nonReadableBodyHttpMethods, request.getMethod())); |
| 333 | + protected boolean isReadable(HttpMethod httpMethod) { |
| 334 | + return !(CollectionUtils.containsInstance(NON_READABLE_BODY_HTTP_METHODS, httpMethod)); |
337 | 335 | }
|
338 | 336 |
|
339 | 337 | }
|
0 commit comments