diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUntils.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java
similarity index 90%
rename from spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUntils.java
rename to spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java
index 1c43921833..f03863c9b7 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUntils.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpAdapterParsingUtils.java
@@ -26,12 +26,12 @@ import org.springframework.beans.factory.xml.ParserContext;
*/
abstract class HttpAdapterParsingUtils {
- private static final String[] REST_TEMPLATE_ATTRIBUTES = {
+ static final String[] REST_TEMPLATE_REFERENCE_ATTRIBUTES = {
"request-factory", "error-handler", "message-converters"
};
static void verifyNoRestTemplateAttributes(Element element, ParserContext parserContext) {
- for (String attributeName : REST_TEMPLATE_ATTRIBUTES) {
+ for (String attributeName : REST_TEMPLATE_REFERENCE_ATTRIBUTES) {
if (element.hasAttribute(attributeName)) {
parserContext.getReaderContext().error("When providing a 'rest-template' reference, the '"
+ attributeName + "' attribute is not allowed.",
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParser.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParser.java
index 3493c491e7..46569dc733 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParser.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -49,14 +49,14 @@ public class HttpOutboundChannelAdapterParser extends AbstractOutboundChannelAda
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "http-method");
String restTemplate = element.getAttribute("rest-template");
- if (StringUtils.hasText(restTemplate)){
+ if (StringUtils.hasText(restTemplate)) {
HttpAdapterParsingUtils.verifyNoRestTemplateAttributes(element, parserContext);
- builder.addConstructorArgReference("restTemplate");
+ builder.addConstructorArgReference(restTemplate);
}
else {
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converters");
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-handler");
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "request-factory");
+ for (String referenceAttributeName : HttpAdapterParsingUtils.REST_TEMPLATE_REFERENCE_ATTRIBUTES) {
+ IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, referenceAttributeName);
+ }
}
String headerMapper = element.getAttribute("header-mapper");
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundGatewayParser.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundGatewayParser.java
index 077fcafd90..f30bbd9a73 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundGatewayParser.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundGatewayParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -51,14 +51,14 @@ public class HttpOutboundGatewayParser extends AbstractConsumerEndpointParser {
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "http-method");
String restTemplate = element.getAttribute("rest-template");
- if (StringUtils.hasText(restTemplate)){
+ if (StringUtils.hasText(restTemplate)) {
HttpAdapterParsingUtils.verifyNoRestTemplateAttributes(element, parserContext);
- builder.addConstructorArgReference("restTemplate");
+ builder.addConstructorArgReference(restTemplate);
}
else {
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converters");
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-handler");
- IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "request-factory");
+ for (String referenceAttributeName : HttpAdapterParsingUtils.REST_TEMPLATE_REFERENCE_ATTRIBUTES) {
+ IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, referenceAttributeName);
+ }
}
String headerMapper = element.getAttribute("header-mapper");
diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests-context.xml b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests-context.xml
index 57d757e260..b203204a64 100644
--- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests-context.xml
+++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParserTests-context.xml
@@ -14,9 +14,9 @@
-
+
-
+