SWS-691 - Annotation-driven tag does not support ws-addressing @Action

This commit is contained in:
Arjen Poutsma
2011-03-22 12:00:30 +00:00
parent 9eb37a77e9
commit 04aab9f6b0
4 changed files with 38 additions and 10 deletions

View File

@@ -39,6 +39,7 @@ import org.springframework.ws.server.endpoint.adapter.method.dom.XomPayloadMetho
import org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor;
import org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor;
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
@@ -92,6 +93,11 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
createBeanDefinition(SoapActionAnnotationMethodEndpointMapping.class, source);
soapActionMappingDef.getPropertyValues().add("order", 1);
parserContext.getReaderContext().registerWithGeneratedName(soapActionMappingDef);
RootBeanDefinition annActionMappingDef =
createBeanDefinition(AnnotationActionEndpointMapping.class, source);
annActionMappingDef.getPropertyValues().add("order", 2);
parserContext.getReaderContext().registerWithGeneratedName(annActionMappingDef);
}
private void registerEndpointAdapters(Element element, Object source, ParserContext parserContext) {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
@@ -22,6 +22,7 @@ import java.util.Iterator;
import javax.xml.transform.TransformerException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Ordered;
import org.springframework.util.Assert;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.EndpointInterceptor;
@@ -63,7 +64,7 @@ import org.springframework.xml.transform.TransformerObjectSupport;
* @since 1.5.0
*/
public abstract class AbstractAddressingEndpointMapping extends TransformerObjectSupport
implements SoapEndpointMapping, InitializingBean {
implements SoapEndpointMapping, InitializingBean, Ordered {
private String[] actorsOrRoles;
@@ -79,6 +80,9 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
private EndpointInterceptor[] postInterceptors = new EndpointInterceptor[0];
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
/** Protected constructor. Initializes the default settings. */
protected AbstractAddressingEndpointMapping() {
initDefaultStrategies();
@@ -108,6 +112,22 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
this.isUltimateReceiver = ultimateReceiver;
}
public final int getOrder() {
return order;
}
/**
* Specify the order value for this mapping.
* <p/>
* Default value is {@link Integer#MAX_VALUE}, meaning that it's non-ordered.
*
* @see org.springframework.core.Ordered#getOrder()
*/
public final void setOrder(int order) {
this.order = order;
}
/**
* Set additional interceptors to be applied before the implicit WS-Addressing interceptor, e.g.
* <code>XwsSecurityInterceptor</code>.

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
@@ -33,8 +33,8 @@ import org.springframework.ws.soap.addressing.server.annotation.Action;
import org.springframework.ws.soap.addressing.server.annotation.Address;
/**
* Implementation of the {@link org.springframework.ws.server.EndpointMapping} interface that uses the {@link Action}
* annotation to map methods to a WS-Addressing <code>Action</code> header.
* Implementation of the {@link org.springframework.ws.server.EndpointMapping} interface that uses the
* {@link Action @Action} annotation to map methods to a WS-Addressing {@code Action} header.
* <p/>
* Endpoints typically have the following form:
* <pre>
@@ -48,9 +48,9 @@ import org.springframework.ws.soap.addressing.server.annotation.Address;
* }
* </pre>
* <p/>
* If set, the {@link Address} annotation on the endpoint class should be equal to the {@link
* If set, the {@link Address @Address} annotation on the endpoint class should be equal to the {@link
* org.springframework.ws.soap.addressing.core.MessageAddressingProperties#getTo() destination} property of the
* incominging message.
* incoming message.
*
* @author Arjen Poutsma
* @see Action

View File

@@ -38,6 +38,7 @@ import org.springframework.ws.server.endpoint.adapter.method.dom.XomPayloadMetho
import org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor;
import org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor;
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
@@ -63,9 +64,10 @@ public class AnnotationDrivenBeanDefinitionParserTest {
@Test
public void endpointMappings() {
Map<String, EndpointMapping> result = applicationContext.getBeansOfType(EndpointMapping.class);
assertEquals("invalid amount of endpoint mappings found", 2, result.size());
assertEquals("invalid amount of endpoint mappings found", 3, result.size());
assertContainsInstanceOf(result.values(), PayloadRootAnnotationMethodEndpointMapping.class);
assertContainsInstanceOf(result.values(), SoapActionAnnotationMethodEndpointMapping.class);
assertContainsInstanceOf(result.values(), AnnotationActionEndpointMapping.class);
}
@Test