Skip to content

Commit 0c9cb71

Browse files
committed
Merge branch '4.0.x'
Closes gh-1518
2 parents 6dcf78d + 5d5bd57 commit 0c9cb71

File tree

2 files changed

+70
-40
lines changed
  • spring-ws-core/src/main/java/org/springframework/ws/config/annotation
  • spring-ws-docs/src/docs/asciidoc

2 files changed

+70
-40
lines changed

spring-ws-core/src/main/java/org/springframework/ws/config/annotation/EnableWs.java

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,70 @@
2222
import java.lang.annotation.RetentionPolicy;
2323
import java.lang.annotation.Target;
2424

25-
import org.springframework.context.annotation.Configuration;
2625
import org.springframework.context.annotation.Import;
2726

2827
/**
29-
* Add this annotation to an {@link Configuration @Configuration} class to have the Spring
30-
* Web Services configuration defined in {@link WsConfigurationSupport} imported. For
31-
* instance:
28+
* Adding this annotation to an {@code @Configuration} class imports the Spring Web
29+
* Services configuration from {@link WsConfigurationSupport}, for example:
3230
*
3331
* <pre><code class='java'>
3432
* &#064;Configuration
3533
* &#064;EnableWs
36-
* &#064;ComponentScan(basePackageClasses = { MyConfiguration.class })
37-
* public class MyWsConfiguration {
34+
* &#064;ComponentScan(basePackageClasses = MyConfiguration.class)
35+
* public class MyConfiguration {
3836
*
3937
* }</code></pre>
4038
* <p>
41-
* Customize the imported configuration by implementing the {@link WsConfigurer}
42-
* interface: <pre><code class='java'>
39+
* Customize the imported configuration by implementing the {@link WsConfigurer} interface
40+
* and overriding individual methods:
41+
*
42+
* <pre><code class='java'>
4343
* &#064;Configuration
4444
* &#064;EnableWs
45-
* &#064;ComponentScan(basePackageClasses = { MyConfiguration.class })
45+
* &#064;ComponentScan(basePackageClasses = MyConfiguration.class)
4646
* public class MyConfiguration implements WsConfigurer {
4747
*
48-
* &#064;Override
49-
* public void addInterceptors(List&lt;EndpointInterceptor&gt; interceptors) {
50-
* interceptors.add(new MyInterceptor());
51-
* }
48+
* &#064;Override
49+
* public void addInterceptors(List&lt;EndpointInterceptor&gt; interceptors) {
50+
* interceptors.add(new MyInterceptor());
51+
* }
5252
*
53-
* &#064;Override
54-
* public void addArgumentResolvers(List&lt;MethodArgumentResolver&gt; argumentResolvers) {
55-
* argumentResolvers.add(new MyArgumentResolver());
56-
* }
53+
* &#064;Override
54+
* public void addArgumentResolvers(List&lt;MethodArgumentResolver&gt; argumentResolvers) {
55+
* argumentResolvers.add(new MyArgumentResolver());
56+
* }
5757
*
58-
* // More overridden methods ...
5958
* }</code></pre>
6059
* <p>
61-
* If the customization options of {@link WsConfigurer} do not expose something you need
62-
* to configure, consider removing the {@code @EnableWs} annotation and extending directly
63-
* from {@link WsConfigurationSupport} overriding selected {@code @Bean} methods:
60+
* <strong>Note:</strong> only one {@code @Configuration} class may have the
61+
* {@code @EnableWs} annotation to import the Spring Web Services configuration. There can
62+
* however be multiple {@code @Configuration} classes implementing {@code WsConfigurer} in
63+
* order to customize the provided configuration.
64+
* <p>
65+
* If {@link WsConfigurer} does not expose some more advanced setting that needs to be
66+
* configured, consider removing the {@code @EnableWs} annotation and extending directly
67+
* from {@link WsConfigurationSupport} or {@link DelegatingWsConfiguration}, for example:
6468
*
6569
* <pre><code class='java'>
6670
* &#064;Configuration
6771
* &#064;ComponentScan(basePackageClasses = { MyConfiguration.class })
6872
* public class MyConfiguration extends WsConfigurationSupport {
6973
*
70-
* &#064;Override
71-
* public void addInterceptors(List&lt;EndpointInterceptor&gt; interceptors) {
72-
* interceptors.add(new MyInterceptor());
73-
* }
74+
* &#064;Override
75+
* public void addInterceptors(List&lt;EndpointInterceptor&gt; interceptors) {
76+
* interceptors.add(new MyInterceptor());
77+
* }
7478
*
75-
* &#064;Bean
76-
* &#064;Override
77-
* public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
78-
* // Create or delegate to "super" to create and
79-
* // customize properties of DefaultMethodEndpointAdapter
80-
* }
79+
* &#064;Bean
80+
* &#064;Override
81+
* public PayloadRootAnnotationMethodEndpointMapping payloadRootAnnotationMethodEndpointMapping() {
82+
* // Create or delegate to "super" to create and
83+
* // customize properties of PayloadRootAnnotationMethodEndpointMapping
84+
* }
8185
* }</code></pre>
8286
*
8387
* @author Arjen Poutsma
88+
* @author Stephane Nicoll
8489
* @since 2.2
8590
* @see WsConfigurer
8691
* @see WsConfigurationSupport

spring-ws-docs/src/docs/asciidoc/server.adoc

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,14 +633,14 @@ public class EchoConfig {
633633
----
634634
====
635635

636-
To customize the `@EnableWs` configuration, you can implement `WsConfigurer`:
636+
To customize the `@EnableWs` configuration, you can implement `WsConfigurer` and override individual methods:
637637

638638
====
639639
[source,java]
640640
----
641641
@Configuration
642642
@EnableWs
643-
public class MyConfiguration implements WsConfigurer {
643+
public class EchoConfig implements WsConfigurer {
644644
645645
@Override
646646
public void addInterceptors(List<EndpointInterceptor> interceptors) {
@@ -652,7 +652,30 @@ public class MyConfiguration implements WsConfigurer {
652652
argumentResolvers.add(new MyArgumentResolver());
653653
}
654654
655-
// More overridden methods ...
655+
}
656+
----
657+
====
658+
659+
If `WsConfigurer` does not expose some more advanced setting that needs to be configured, consider removing `@EnableWs` and extending directly from `WsConfigurationSupport` or `DelegatingWsConfiguration`.
660+
661+
====
662+
[source,java]
663+
----
664+
@Configuration
665+
public class EchoConfig extends WsConfigurationSupport {
666+
667+
@Override
668+
public void addInterceptors(List<EndpointInterceptor> interceptors) {
669+
interceptors.add(new MyInterceptor());
670+
}
671+
672+
@Bean
673+
@Override
674+
public PayloadRootAnnotationMethodEndpointMapping payloadRootAnnotationMethodEndpointMapping() {
675+
// Create or delegate to "super" to create and
676+
// customize properties of PayloadRootAnnotationMethodEndpointMapping
677+
}
678+
656679
}
657680
----
658681
====
@@ -670,7 +693,7 @@ If you want to use a different scope, such as prototype, see the {spring-framewo
670693
Note that all abstract base classes provided in Spring-WS are thread safe, unless otherwise indicated in the class-level Javadoc.
671694

672695
[[server-atEndpoint-methods]]
673-
=== `@Endpoint` handling methods
696+
== `@Endpoint` handling methods
674697

675698
For an endpoint to actually handle incoming XML messages, it needs to have one or more handling methods.
676699
Handling methods can take wide range of parameters and return types.
@@ -697,7 +720,7 @@ The `order` method takes an `Element` (annotated with `@RequestPayload`) as a pa
697720
This means that the payload of the message is passed on this method as a DOM element.
698721
The method has a `void` return type, indicating that no response message is sent.
699722

700-
==== Handling Method Parameters
723+
=== Handling Method Parameters
701724

702725
The handling method typically has one or more parameters that refer to various parts of the incoming XML message.
703726
Most commonly, the handling method has a single parameter that maps to the payload of the message, but it can also map to other parts of the request message, such as a SOAP header.
@@ -808,7 +831,7 @@ You can even extend this mechanism to support your own parameter types.
808831
See the Javadoc of {spring-ws-api}/server/endpoint/adapter/DefaultMethodEndpointAdapter.html[`DefaultMethodEndpointAdapter`] and {spring-ws-api}/server/endpoint/adapter/method/MethodArgumentResolver.html[`MethodArgumentResolver`] to see how.
809832

810833
[[server-xpath-param]]
811-
===== `@XPathParam`
834+
==== `@XPathParam`
812835

813836
One parameter type needs some extra explanation: `@XPathParam`.
814837
The idea here is that you annotate one or more method parameters with an XPath expression and that each such annotated parameter is bound to the evaluation of the expression.
@@ -860,7 +883,7 @@ By using the `@XPathParam`, you can bind to all the data types supported by XPat
860883

861884
In addition to this list, you can use any type that can be converted from a `String` by a Spring {spring-framework-docs}/core/validation/convert.html#core-convert-ConversionService-API[conversion service].
862885

863-
==== Handling method return types
886+
=== Handling method return types
864887

865888
To send a response message, the handling needs to specify a return type.
866889
If no response message is required, the method can declare a `void` return type.
@@ -942,8 +965,8 @@ The concept of configurable endpoint mappings that can optionally contain interc
942965
A lot of supporting functionality can be built into custom `EndpointMapping` implementations.
943966
For example, a custom endpoint mapping could choose an endpoint based not only on the contents of a message but also on a specific SOAP header (or, indeed, multiple SOAP headers).
944967

945-
Most endpoint mappings inherit from the `AbstractEndpointMapping`, which offers an '`interceptors`' property, which is the list of interceptors to use. `EndpointInterceptors` are discussed in <<server-endpoint-interceptor>>.
946-
Additionally, there is the `defaultEndpoint`, which is the default endpoint to use when this endpoint mapping does not result in a matching endpoint.
968+
Most endpoint mappings inherit from the `AbstractEndpointMapping`, which offers an '`interceptors`' property, which is the list of interceptors to use.
969+
`EndpointInterceptors` are discussed in <<server-endpoint-interceptor>>.
947970

948971
As explained in <<server-endpoints>>, the `@Endpoint` style lets you handle multiple requests in one endpoint class.
949972
This is the responsibility of the `MethodEndpointMapping`.
@@ -957,6 +980,8 @@ Whenever a message comes in with this qualified name for the payload root elemen
957980
Alternatively, the `SoapActionAnnotationMethodEndpointMapping` uses the `@SoapAction` annotation to mark methods with a particular SOAP Action.
958981
Whenever a message comes in with this `SOAPAction` header, the method is invoked.
959982

983+
`AbstractEndpointMapping` implementations provides a `defaultEndpoint` property that configures the endpoint to use when a configured mapping does not result in a matching endpoint.
984+
960985
[[server-ws-addressing]]
961986
=== WS-Addressing
962987

0 commit comments

Comments
 (0)