diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/HttpRequestHandlingEndpointSupport.java b/spring-integration-http/src/main/java/org/springframework/integration/http/HttpRequestHandlingEndpointSupport.java index 47db8eaefd..52f96ef5c9 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/HttpRequestHandlingEndpointSupport.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/HttpRequestHandlingEndpointSupport.java @@ -54,6 +54,29 @@ import org.springframework.web.servlet.DispatcherServlet; /** * Base class for HTTP request handling endpoints. + *
+ * By default GET and POST requests are accepted, but the 'supportedMethods' + * property may be set to include others or limit the options (e.g. POST only). + * A GET request will generate a payload containing its 'parameterMap' while + * a POST request will be converted to a Message payload according to + * the registered {@link HttpMessageConverter}s. Several are registered + * by default, but the list can be explicitly set via {@link #setMessageConverters(List)}. + * + * To customize the mapping of request headers to the MessageHeaders, provide + * a reference to a {@link HeaderMapper HeaderMapperfalse
+ * to the constructor to force send-only as opposed to sendAndReceive.
+ * Send-only means that as soon as the Message is created and passed to the
+ * {@link #setRequestChannel(org.springframework.integration.core.MessageChannel) request channel},
+ * a response will be generated. Subclasses determine how that response is
+ * generated (e.g. simple status response or rendering a View).
+ *
+ * In a request-reply scenario, the reply Message's payload will be
+ * extracted prior to generating a response by default. To have the entire
+ * serialized Message available for the response, switch the
+ * {@link #extractReplyPayload} value to false.
*
* @author Mark Fisher
* @since 2.0
@@ -71,10 +94,10 @@ abstract class HttpRequestHandlingEndpointSupport extends AbstractMessagingGatew
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", HttpRequestHandlingEndpointSupport.class.getClassLoader());
- private volatile Class> conversionTargetType = null;
-
private volatile Listbyte[].class.
*/
- public void setConversionTargetType(Class> conversionTargetType) {
- this.conversionTargetType = conversionTargetType;
+ public void setRequestPayloadType(Class> requestPayloadType) {
+ this.requestPayloadType = requestPayloadType;
}
/**
@@ -322,17 +345,17 @@ abstract class HttpRequestHandlingEndpointSupport extends AbstractMessagingGatew
@SuppressWarnings("unchecked")
private Object generatePayloadFromRequestBody(ServletServerHttpRequest request) throws IOException {
MediaType contentType = request.getHeaders().getContentType();
- Class> targetType = this.conversionTargetType;
- if (targetType == null) {
- targetType = ("text".equals(contentType.getType())) ? String.class : byte[].class;
+ Class> expectedType = this.requestPayloadType;
+ if (expectedType == null) {
+ expectedType = ("text".equals(contentType.getType())) ? String.class : byte[].class;
}
for (HttpMessageConverter> converter : this.messageConverters) {
- if (converter.canRead(targetType, contentType)) {
- return converter.read((Class) targetType, request);
+ if (converter.canRead(expectedType, contentType)) {
+ return converter.read((Class) expectedType, request);
}
}
throw new MessagingException("Could not convert request: no suitable HttpMessageConverter found for expected type [" +
- targetType.getName() + "] and content type [" + contentType + "]");
+ expectedType.getName() + "] and content type [" + contentType + "]");
}
}
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpInboundEndpointParser.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpInboundEndpointParser.java
index 8054f54db1..51a30cdb32 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpInboundEndpointParser.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpInboundEndpointParser.java
@@ -86,7 +86,7 @@ public class HttpInboundEndpointParser extends AbstractSingleBeanDefinitionParse
builder, element, "send-timeout", "requestTimeout");
}
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "supported-methods", "supportedMethodNames");
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "conversion-target-type");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "request-payload-type");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "view-name");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converters");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "header-mapper");
diff --git a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.0.xsd b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.0.xsd
index 78ee5fac5b..8887c95731 100644
--- a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.0.xsd
+++ b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.0.xsd
@@ -34,7 +34,7 @@
-