Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2002-2013 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.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.integration.http.config;
Parser for the 'outbound-gateway' element of the http namespace.

Author(s):
Mark Fisher
Oleg Zhurakousky
Gary Russell
Artem Bilan
		return "request-channel";
	}
	protected BeanDefinitionBuilder parseHandler(Element elementParserContext parserContext) {
		HttpAdapterParsingUtils.configureUrlConstructorArg(elementparserContextbuilder);
		IntegrationNamespaceUtils.setValueIfAttributeDefined(builderelement"encode-uri");
		HttpAdapterParsingUtils.setHttpMethodOrExpression(elementparserContextbuilder);
		String restTemplate = element.getAttribute("rest-template");
		if (StringUtils.hasText(restTemplate)) {
			HttpAdapterParsingUtils.verifyNoRestTemplateAttributes(elementparserContext);
			builder.addConstructorArgReference(restTemplate);
		}
		else {
				IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builderelementreferenceAttributeName);
			}
		}
		String headerMapper = element.getAttribute("header-mapper");
		String mappedRequestHeaders = element.getAttribute("mapped-request-headers");
		String mappedResponseHeaders = element.getAttribute("mapped-response-headers");
		if (StringUtils.hasText(headerMapper)) {
			if (StringUtils.hasText(mappedRequestHeaders) || StringUtils.hasText(mappedResponseHeaders)) {
				parserContext.getReaderContext().error("Neither 'mappped-request-headers' or 'mapped-response-headers' " +
						"attributes are allowed when a 'header-mapper' has been specified."parserContext.extractSource(element));
				return null;
			}
			builder.addPropertyReference("headerMapper"headerMapper);
		}
		else {
			BeanDefinitionBuilder headerMapperBuilder = BeanDefinitionBuilder.genericBeanDefinition(
					"org.springframework.integration.http.support.DefaultHttpHeaderMapper");
			headerMapperBuilder.setFactoryMethod("outboundMapper");
			IntegrationNamespaceUtils.setValueIfAttributeDefined(headerMapperBuilderelement"mapped-request-headers""outboundHeaderNames");
			IntegrationNamespaceUtils.setValueIfAttributeDefined(headerMapperBuilderelement"mapped-response-headers""inboundHeaderNames");
			builder.addPropertyValue("headerMapper"headerMapperBuilder.getBeanDefinition());
		}
		IntegrationNamespaceUtils.setValueIfAttributeDefined(builderelement"charset");
		IntegrationNamespaceUtils.setValueIfAttributeDefined(builderelement"extract-request-payload""extractPayload");
		HttpAdapterParsingUtils.setExpectedResponseOrExpression(elementparserContextbuilder);
		IntegrationNamespaceUtils.setValueIfAttributeDefined(builderelement"reply-timeout""sendTimeout");
		IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builderelement"reply-channel""outputChannel");
		HttpAdapterParsingUtils.configureUriVariableExpressions(builderparserContextelement);
		IntegrationNamespaceUtils.setValueIfAttributeDefined(builderelement"transfer-cookies");
		return builder;
	}
New to GrepCode? Check out our FAQ X