Skip to content

Commit 04aab9f

Browse files
committed
SWS-691 - Annotation-driven tag does not support ws-addressing @action
1 parent 9eb37a7 commit 04aab9f

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

core/src/main/java/org/springframework/ws/config/AnnotationDrivenBeanDefinitionParser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor;
4040
import org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor;
4141
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
42+
import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
4243
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
4344
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
4445

@@ -92,6 +93,11 @@ private void registerEndpointMappings(Object source, ParserContext parserContext
9293
createBeanDefinition(SoapActionAnnotationMethodEndpointMapping.class, source);
9394
soapActionMappingDef.getPropertyValues().add("order", 1);
9495
parserContext.getReaderContext().registerWithGeneratedName(soapActionMappingDef);
96+
97+
RootBeanDefinition annActionMappingDef =
98+
createBeanDefinition(AnnotationActionEndpointMapping.class, source);
99+
annActionMappingDef.getPropertyValues().add("order", 2);
100+
parserContext.getReaderContext().registerWithGeneratedName(annActionMappingDef);
95101
}
96102

97103
private void registerEndpointAdapters(Element element, Object source, ParserContext parserContext) {

core/src/main/java/org/springframework/ws/soap/addressing/server/AbstractAddressingEndpointMapping.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,7 @@
2222
import javax.xml.transform.TransformerException;
2323

2424
import org.springframework.beans.factory.InitializingBean;
25+
import org.springframework.core.Ordered;
2526
import org.springframework.util.Assert;
2627
import org.springframework.ws.context.MessageContext;
2728
import org.springframework.ws.server.EndpointInterceptor;
@@ -63,7 +64,7 @@
6364
* @since 1.5.0
6465
*/
6566
public abstract class AbstractAddressingEndpointMapping extends TransformerObjectSupport
66-
implements SoapEndpointMapping, InitializingBean {
67+
implements SoapEndpointMapping, InitializingBean, Ordered {
6768

6869
private String[] actorsOrRoles;
6970

@@ -79,6 +80,9 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
7980

8081
private EndpointInterceptor[] postInterceptors = new EndpointInterceptor[0];
8182

83+
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
84+
85+
8286
/** Protected constructor. Initializes the default settings. */
8387
protected AbstractAddressingEndpointMapping() {
8488
initDefaultStrategies();
@@ -108,6 +112,22 @@ public final void setUltimateReceiver(boolean ultimateReceiver) {
108112
this.isUltimateReceiver = ultimateReceiver;
109113
}
110114

115+
public final int getOrder() {
116+
return order;
117+
}
118+
119+
/**
120+
* Specify the order value for this mapping.
121+
* <p/>
122+
* Default value is {@link Integer#MAX_VALUE}, meaning that it's non-ordered.
123+
*
124+
* @see org.springframework.core.Ordered#getOrder()
125+
*/
126+
public final void setOrder(int order) {
127+
this.order = order;
128+
}
129+
130+
111131
/**
112132
* Set additional interceptors to be applied before the implicit WS-Addressing interceptor, e.g.
113133
* <code>XwsSecurityInterceptor</code>.

core/src/main/java/org/springframework/ws/soap/addressing/server/AnnotationActionEndpointMapping.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,8 +33,8 @@
3333
import org.springframework.ws.soap.addressing.server.annotation.Address;
3434

3535
/**
36-
* Implementation of the {@link org.springframework.ws.server.EndpointMapping} interface that uses the {@link Action}
37-
* annotation to map methods to a WS-Addressing <code>Action</code> header.
36+
* Implementation of the {@link org.springframework.ws.server.EndpointMapping} interface that uses the
37+
* {@link Action @Action} annotation to map methods to a WS-Addressing {@code Action} header.
3838
* <p/>
3939
* Endpoints typically have the following form:
4040
* <pre>
@@ -48,9 +48,9 @@
4848
* }
4949
* </pre>
5050
* <p/>
51-
* If set, the {@link Address} annotation on the endpoint class should be equal to the {@link
51+
* If set, the {@link Address @Address} annotation on the endpoint class should be equal to the {@link
5252
* org.springframework.ws.soap.addressing.core.MessageAddressingProperties#getTo() destination} property of the
53-
* incominging message.
53+
* incoming message.
5454
*
5555
* @author Arjen Poutsma
5656
* @see Action

core/src/test/java/org/springframework/ws/config/AnnotationDrivenBeanDefinitionParserTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor;
3939
import org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor;
4040
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
41+
import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
4142
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
4243
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
4344

@@ -63,9 +64,10 @@ public void setUp() throws Exception {
6364
@Test
6465
public void endpointMappings() {
6566
Map<String, EndpointMapping> result = applicationContext.getBeansOfType(EndpointMapping.class);
66-
assertEquals("invalid amount of endpoint mappings found", 2, result.size());
67+
assertEquals("invalid amount of endpoint mappings found", 3, result.size());
6768
assertContainsInstanceOf(result.values(), PayloadRootAnnotationMethodEndpointMapping.class);
6869
assertContainsInstanceOf(result.values(), SoapActionAnnotationMethodEndpointMapping.class);
70+
assertContainsInstanceOf(result.values(), AnnotationActionEndpointMapping.class);
6971
}
7072

7173
@Test

0 commit comments

Comments
 (0)