Setters now expect a Map with Expression values
This commit is contained in:
@@ -28,8 +28,6 @@ import org.springframework.context.expression.BeanFactoryResolver;
|
||||
import org.springframework.context.expression.MapAccessor;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.expression.spel.support.StandardTypeConverter;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -38,7 +36,6 @@ import org.springframework.integration.MessageDeliveryException;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriTemplate;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
@@ -61,9 +58,6 @@ import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
*/
|
||||
public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private static final ExpressionParser PARSER = new SpelExpressionParser();
|
||||
|
||||
|
||||
private final WebServiceTemplate webServiceTemplate;
|
||||
|
||||
private final UriTemplate uriTemplate;
|
||||
@@ -103,14 +97,10 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
* Set the Map of URI variable expressions to evaluate against the outbound message
|
||||
* when replacing the variable placeholders in a URI template.
|
||||
*/
|
||||
public void setUriVariableExpressions(Map<String, String> uriVariableExpressions) {
|
||||
public void setUriVariableExpressions(Map<String, Expression> uriVariableExpressions) {
|
||||
synchronized (this.uriVariableExpressions) {
|
||||
this.uriVariableExpressions.clear();
|
||||
if (!CollectionUtils.isEmpty(uriVariableExpressions)) {
|
||||
for (Map.Entry<String, String> entry : uriVariableExpressions.entrySet()) {
|
||||
this.uriVariableExpressions.put(entry.getKey(), PARSER.parseExpression(entry.getValue()));
|
||||
}
|
||||
}
|
||||
this.uriVariableExpressions.putAll(uriVariableExpressions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
package org.springframework.integration.ws.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.support.ManagedMap;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.ExpressionFactoryBean;
|
||||
import org.springframework.integration.config.xml.AbstractOutboundGatewayParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -70,11 +70,13 @@ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayPars
|
||||
else {
|
||||
builder.addConstructorArgValue(uri);
|
||||
if (!CollectionUtils.isEmpty(uriVariableElements)) {
|
||||
Map<String, String> uriVariableExpressions = new HashMap<String, String>();
|
||||
ManagedMap<String, Object> uriVariableExpressions = new ManagedMap<String, Object>();
|
||||
for (Element uriVariableElement : uriVariableElements) {
|
||||
String name = uriVariableElement.getAttribute("name");
|
||||
String expression = uriVariableElement.getAttribute("expression");
|
||||
uriVariableExpressions.put(name, expression);
|
||||
BeanDefinitionBuilder factoryBeanBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class);
|
||||
factoryBeanBuilder.addConstructorArgValue(expression);
|
||||
uriVariableExpressions.put(name, factoryBeanBuilder.getBeanDefinition());
|
||||
}
|
||||
builder.addPropertyValue("uriVariableExpressions", uriVariableExpressions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user