You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/09/02 05:05:05 UTC
(camel) branch main updated: Spring WS docs and code cleanup. (#15382)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 752b98f8011 Spring WS docs and code cleanup. (#15382)
752b98f8011 is described below
commit 752b98f80116efa8dd8de4446edf712873c30133
Author: Adriano Machado <60...@users.noreply.github.com>
AuthorDate: Mon Sep 2 01:04:58 2024 -0400
Spring WS docs and code cleanup. (#15382)
* Spring WS docs and code cleanup.
* Missing files from compilation
* Adding .gitignore entry for camel-ignite build leftovers on MacOS
---
components/camel-ignite/.gitignore | 1 +
.../src/main/docs/spring-ws-component.adoc | 39 +++++++++-----------
.../spring/ws/SpringWebserviceComponent.java | 22 +++++------
.../spring/ws/SpringWebserviceConsumer.java | 18 ++++-----
.../spring/ws/bean/CamelDirectConnection.java | 2 +-
.../spring/ws/bean/CamelEndpointMapping.java | 5 +--
.../ws/bean/CamelSpringWSEndpointMapping.java | 2 +-
.../spring/ws/bean/WSACamelEndpointMapping.java | 43 ++++++++++------------
.../spring/ws/converter/StringSourceConverter.java | 8 ++--
.../spring/ws/filter/impl/BasicMessageFilter.java | 9 ++---
.../impl/HeaderTransformationMessageFilter.java | 3 +-
.../spring/ws/type/EndpointMappingType.java | 2 +-
.../ProducerWss4JSecurityHeaderManualTest.java | 14 +++----
13 files changed, 74 insertions(+), 94 deletions(-)
diff --git a/components/camel-ignite/.gitignore b/components/camel-ignite/.gitignore
index e69de29bb2d..baeba64b2d9 100644
--- a/components/camel-ignite/.gitignore
+++ b/components/camel-ignite/.gitignore
@@ -0,0 +1 @@
+ignite
\ No newline at end of file
diff --git a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
index 8d94ca1f963..cb7737a7ba0 100644
--- a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
+++ b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
@@ -16,7 +16,7 @@
*{component-header}*
The Spring WS component allows you to integrate with
-http://static.springsource.org/spring-ws/sites/1.5/[Spring Web
+https://docs.spring.io/spring-ws/docs/4.0.x/reference/html/[Spring Web
Services]. It offers both _client_-side support, for accessing web
services, and _server_-side support for creating your own contract-first
web services.
@@ -59,6 +59,8 @@ the header of the message.
|`uri` |To map web service requests that target a specific URI.
+|`uripath` |To map web service requests that target a specific path in URI.
+
|`xpathresult` |Used to map web service requests based on the evaluation of an XPath
`expression` against the incoming message. The result of the evaluation
should match the XPath result specified in the endpoint URI.
@@ -66,14 +68,14 @@ should match the XPath result specified in the endpoint URI.
|`beanname` |Allows you to reference an
`org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher`
object to integrate with existing (legacy)
-http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping[endpoint
+https://docs.spring.io/spring-ws/docs/4.0.x/reference/html/#server-endpoint-mapping[endpoint
mappings] like `PayloadRootQNameEndpointMapping`,
`SoapActionEndpointMapping`, etc.
|=======================================================================
As a consumer, the *address* should contain a value relevant to the
specified mapping-type (e.g. a SOAP action, XPath expression). As a
- producer, the address should be set to the URI of the web service your
+producer, the address should be set to the URI of the web service your
calling upon.
@@ -161,16 +163,16 @@ Likewise, the spring-ws consumer will also enrich the Camel Message with
the SOAP header.
For example, see this
-https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java[unit
+https://github.com/apache/camel/blob/main/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java[unit
test].
=== The header and attachment propagation
Spring WS Camel supports propagation of the headers and attachments into
-Spring-WS WebServiceMessage response. The
-endpoint will use so-called "hook" the MessageFilter (default
-implementation is provided by BasicMessageFilter) to propagate the
-exchange headers and attachments into WebServiceMessage response. Now
+Spring-WS `WebServiceMessage` response. The
+endpoint will use so-called "hook" the `MessageFilter` (default
+implementation is provided by `BasicMessageFilter`) to propagate the
+exchange headers and attachments into `WebServiceMessage` response. Now
you can use
[source,java]
@@ -188,7 +190,7 @@ a QName class directly and put any key into header.
=== How to transform the soap header using a stylesheet
-The header transformation filter (HeaderTransformationMessageFilter.java)
+The header transformation filter (`HeaderTransformationMessageFilter`)
can be used to transform the soap header for a soap request. If you want to use
the header transformation filter, see the below example:
@@ -212,9 +214,9 @@ Use the bead defined above in the camel endpoint
=== The custom header and attachment filtering
If you need to provide your custom processing of either headers or
-attachments, extend existing BasicMessageFilter and override the
+attachments, extend existing `BasicMessageFilter` and override the
appropriate methods or write a brand-new implementation of the
-MessageFilter interface.
+`MessageFilter` interface.
To use your custom filter, add this into your spring context:
You can specify either a global a or a local message filter as
@@ -275,20 +277,13 @@ Spring configuration:
</bean>
</property>
</bean>
-
-<!-- force use of Sun SAAJ implementation, https://static.springsource.org/spring-ws/sites/1.5/faq.html#saaj-jboss -->
-<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
- <property name="messageFactory">
- <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
- </property>
-</bean>
---------------------------------------------------------------------------------------------------------------------
=== Exposing web services
To expose a web service using this component, you first need to
set up a
-http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html[MessageDispatcher]
+https://docs.spring.io/spring-ws/docs/4.0.x/reference/html/#_the_messagedispatcher[MessageDispatcher]
to look for endpoint mappings in a Spring XML file. If you plan on
running inside a servlet container, you probably want to use a
`MessageDispatcherServlet` configured in `web.xml`.
@@ -335,7 +330,7 @@ _spring-ws-servlet.xml_
----------------------------------------------------------------------------------------------------
More information on setting up Spring-WS can be found in
-http://static.springsource.org/spring-ws/sites/1.5/reference/html/tutorial.html[Writing
+https://docs.spring.io/spring-ws/docs/4.0.x/reference/html/#tutorial[Writing
Contract-First Web Services]. Basically paragraph 3.6 "Implementing the
Endpoint" is handled by this component (specifically paragraph 3.6.2
"Routing the Message to the Endpoint" is where `CamelEndpointMapping`
@@ -389,9 +384,9 @@ from("spring-ws:xpathresult:abc?expression=//foobar&endpointMapping=#endpointMap
For every endpoint with mapping-type `beanname` one bean of type
`CamelEndpointDispatcher` with a corresponding name is required in the
-Registry/ApplicationContext. This bean acts as a bridge between the
+`Registry`/`ApplicationContext`. This bean acts as a bridge between the
Camel endpoint and an existing
-http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping[endpoint
+https://docs.spring.io/spring-ws/docs/4.0.x/reference/html/#server-endpoint-mapping[endpoint
mapping] like `PayloadRootQNameEndpointMapping`.
[NOTE]
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
index b5eb825ac20..60a8b7dc55a 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
@@ -75,20 +75,19 @@ public class SpringWebserviceComponent extends DefaultComponent implements SSLCo
if (type != null) {
LOG.debug("Building Spring Web Services consumer of type {}", type);
String lookupKey = getLookupKey(remaining, type);
+ configuration.setEndpointMappingType(type);
+ configuration.setEndpointMappingLookupKey(lookupKey);
if (EndpointMappingType.BEANNAME.equals(type)) {
addEndpointDispatcherToConfiguration(configuration, lookupKey);
} else {
addEndpointMappingToConfiguration(parameters, configuration);
+ if (type.equals(EndpointMappingType.XPATHRESULT)) {
+ String expression = getAndRemoveParameter(parameters, "expression", String.class);
+ configuration.setExpression(expression);
+ XPathExpression xPathExpression = createXPathExpression(expression);
+ configuration.setxPathExpression(xPathExpression);
+ }
}
- XPathExpression xPathExpression = null;
- if (type.equals(EndpointMappingType.XPATHRESULT)) {
- String expression = getAndRemoveParameter(parameters, "expression", String.class);
- configuration.setExpression(expression);
- xPathExpression = createXPathExpression(expression);
- configuration.setxPathExpression(xPathExpression);
- }
- configuration.setEndpointMappingType(type);
- configuration.setEndpointMappingLookupKey(lookupKey);
}
}
@@ -131,8 +130,7 @@ public class SpringWebserviceComponent extends DefaultComponent implements SSLCo
if (xpathExpression == null) {
throw new RuntimeCamelException("Expression parameter is required when using XPath endpoint mapping");
}
- XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression);
- return expression;
+ return XPathExpressionFactory.createXPathExpression(xpathExpression);
}
private void addEndpointMappingToConfiguration(
@@ -159,7 +157,7 @@ public class SpringWebserviceComponent extends DefaultComponent implements SSLCo
/**
* Configures the messageFilter's factory. The factory is looked up in the endpoint's URI and then in the Spring's
* context. The bean search mechanism looks for a bean with the name messageFilter. The endpoint's URI search
- * mechanism looks for the URI's key parameter name messageFilter, for instance like this:
+ * mechanism looks for the URI's key parameter name messageFilter, for instance, like this:
* spring-ws:http://yourdomain.com?messageFilter=<beanName>
*/
private void configureMessageFilter(SpringWebserviceConfiguration configuration) {
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
index 69feccd65dd..3175a053779 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
@@ -46,8 +46,8 @@ import static org.apache.camel.component.spring.ws.SpringWebserviceHelper.toResu
public class SpringWebserviceConsumer extends DefaultConsumer implements MessageEndpoint {
- private SpringWebserviceEndpoint endpoint;
- private SpringWebserviceConfiguration configuration;
+ private final SpringWebserviceEndpoint endpoint;
+ private final SpringWebserviceConfiguration configuration;
public SpringWebserviceConsumer(Endpoint endpoint, Processor processor) {
super(endpoint, processor);
@@ -70,7 +70,7 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
populateExchangeFromMessageContext(messageContext, exchange);
// populate camel exchange with breadcrumb from transport header
- if (getEndpoint().getCamelContext().isUseBreadcrumb()) {
+ if (Boolean.TRUE.equals(getEndpoint().getCamelContext().isUseBreadcrumb())) {
populateExchangeWithBreadcrumbFromMessageContext(messageContext, exchange);
}
@@ -94,8 +94,7 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
}
private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext, Exchange exchange) {
- if (messageContext.getRequest() instanceof SaajSoapMessage) {
- SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest();
+ if (messageContext.getRequest() instanceof SaajSoapMessage saajSoap) {
populateExchangeWithBreadcrumbFromSaajMessage(exchange, saajSoap);
} else {
populateExchangeWithBreadcrumbFromMessageContext(exchange, messageContext);
@@ -171,8 +170,7 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
* @param request the WebService Request
*/
private void extractSourceFromSoapHeader(Map<String, Object> headers, WebServiceMessage request) {
- if (request instanceof SoapMessage) {
- SoapMessage soapMessage = (SoapMessage) request;
+ if (request instanceof SoapMessage soapMessage) {
SoapHeader soapHeader = soapMessage.getSoapHeader();
if (soapHeader != null) {
@@ -203,12 +201,12 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
DefaultAttachmentMessage dam = null;
- if (request instanceof MimeMessage) {
- Iterator<Attachment> attachmentsIterator = ((MimeMessage) request).getAttachments();
+ if (request instanceof MimeMessage mimeMessage) {
+ Iterator<Attachment> attachmentsIterator = mimeMessage.getAttachments();
while (attachmentsIterator.hasNext()) {
Attachment attachment = attachmentsIterator.next();
if (dam == null) {
- // this is just a wrapper which will set data on the IN
+ // this is just a wrapper that will set data on the IN
dam = new DefaultAttachmentMessage(exchange.getIn());
}
dam.addAttachment(attachment.getContentId(), attachment.getDataHandler());
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelDirectConnection.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelDirectConnection.java
index c11140320b9..df8371c222a 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelDirectConnection.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelDirectConnection.java
@@ -34,7 +34,7 @@ import org.springframework.ws.transport.WebServiceConnection;
public class CamelDirectConnection implements WebServiceConnection {
private static final Logger LOG = LoggerFactory.getLogger(CamelDirectConnection.class);
private CamelContext camelContext;
- private URI destination;
+ private final URI destination;
public CamelDirectConnection(CamelContext camelContext, URI uri) throws URISyntaxException {
this.camelContext = camelContext;
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelEndpointMapping.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelEndpointMapping.java
index 645d8d83480..3ad4a735d53 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelEndpointMapping.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelEndpointMapping.java
@@ -83,7 +83,7 @@ public class CamelEndpointMapping extends AbstractEndpointMapping
private static final String DOUBLE_QUOTE = "\"";
private static final String URI_PATH_WILDCARD = "*";
- private Map<EndpointMappingKey, MessageEndpoint> endpoints = new ConcurrentHashMap<>();
+ private final Map<EndpointMappingKey, MessageEndpoint> endpoints = new ConcurrentHashMap<>();
private TransformerFactory transformerFactory;
private CamelContext camelContext;
@@ -157,8 +157,7 @@ public class CamelEndpointMapping extends AbstractEndpointMapping
}
private String getSoapAction(MessageContext messageContext) {
- if (messageContext.getRequest() instanceof SoapMessage) {
- SoapMessage request = (SoapMessage) messageContext.getRequest();
+ if (messageContext.getRequest() instanceof SoapMessage request) {
String soapAction = request.getSoapAction();
if (StringUtils.hasLength(soapAction) && soapAction.startsWith(DOUBLE_QUOTE) && soapAction.endsWith(DOUBLE_QUOTE)) {
return soapAction.substring(1, soapAction.length() - 1);
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelSpringWSEndpointMapping.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelSpringWSEndpointMapping.java
index a55ffde1a7a..e29c3b73bb9 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelSpringWSEndpointMapping.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/CamelSpringWSEndpointMapping.java
@@ -21,7 +21,7 @@ import org.springframework.ws.server.EndpointMapping;
import org.springframework.ws.server.endpoint.MessageEndpoint;
/**
- * Allows to register different spring-ws endpoints for camel.
+ * Allows registering different spring-ws endpoints for camel.
*/
public interface CamelSpringWSEndpointMapping extends EndpointMapping {
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/WSACamelEndpointMapping.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/WSACamelEndpointMapping.java
index 271574121b1..ef33357173e 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/WSACamelEndpointMapping.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/bean/WSACamelEndpointMapping.java
@@ -31,9 +31,10 @@ import org.springframework.ws.server.endpoint.MessageEndpoint;
import org.springframework.ws.soap.addressing.core.MessageAddressingProperties;
import org.springframework.ws.soap.addressing.messageid.MessageIdStrategy;
import org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping;
-import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
import org.springframework.ws.transport.WebServiceMessageSender;
+import static org.springframework.ws.soap.addressing.server.AbstractActionEndpointMapping.DEFAULT_OUTPUT_ACTION_SUFFIX;
+
/**
* Provides support for full WS-Addressing. Supported are faultAction and response action. For more details look at @see
* {@link AbstractAddressingEndpointMapping}. Implementation of the
@@ -45,32 +46,26 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
private static final Logger LOG = LoggerFactory.getLogger(WSACamelEndpointMapping.class);
- private Map<EndpointMappingKey, MessageEndpoint> endpoints = new ConcurrentHashMap<>();
+ private final Map<EndpointMappingKey, MessageEndpoint> endpoints = new ConcurrentHashMap<>();
- private String outputActionSuffix = AnnotationActionEndpointMapping.DEFAULT_OUTPUT_ACTION_SUFFIX;
+ private String outputActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
- private String faultActionSuffix = AnnotationActionEndpointMapping.DEFAULT_OUTPUT_ACTION_SUFFIX;
+ private String faultActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
@Override
protected Object getEndpointInternal(MessageAddressingProperties map) {
// search the endpoint with compositeKeyFirst
for (Map.Entry<EndpointMappingKey, MessageEndpoint> endpointEntry : endpoints.entrySet()) {
EndpointMappingKey key = endpointEntry.getKey();
- String compositeOrSimpleKey = null;
- switch (key.getType()) {
- case ACTION:
- compositeOrSimpleKey = getActionCompositeLookupKey(map);
- break;
- case TO:
- compositeOrSimpleKey = getToCompositeLookupKey(map);
- break;
- default:
- throw new RuntimeCamelException(
- "Invalid mapping type specified. Supported types are: spring-ws:action:<WS-Addressing Action>(optional:<WS-Addressing To>?<params...>\n)"
- + "spring-ws:to:<WS-Addressing To>(optional:<WS-Addressing Action>?<params...>)");
- }
+ String compositeOrSimpleKey = switch (key.getType()) {
+ case ACTION -> getActionCompositeLookupKey(map);
+ case TO -> getToCompositeLookupKey(map);
+ default -> throw new RuntimeCamelException(
+ "Invalid mapping type specified. Supported types are: spring-ws:action:<WS-Addressing Action>(optional:<WS-Addressing To>?<params...>\n)"
+ + "spring-ws:to:<WS-Addressing To>(optional:<WS-Addressing Action>?<params...>)");
+ };
// lookup for specific endpoint
- if (compositeOrSimpleKey != null && key.getLookupKey().equals(compositeOrSimpleKey)) {
+ if (key.getLookupKey().equals(compositeOrSimpleKey)) {
LOG.debug("Found mapping for key {}", key);
return endpointEntry.getValue();
}
@@ -97,7 +92,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
+ "spring-ws:to:<WS-Addressing To>(optional:<WS-Addressing Action>?<params...>)");
}
// look up for less specific endpoint
- if (simpleKey != null && key.getLookupKey().equals(simpleKey)) {
+ if (key.getLookupKey().equals(simpleKey)) {
LOG.debug("Found mapping for key {}", key);
return endpointEntry.getValue();
}
@@ -106,7 +101,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
}
/**
- * Generate a lookupKey for a given WS-Addressing message using action property. The possible combination are:
+ * Generate a lookupKey for a given WS-Addressing message using action property. The possible combination is:
* <ul>
* <li>wsaAction</li>
* <li>wsaAction:wsaGetTo</li>
@@ -222,7 +217,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
protected URI getDefaultResponseAction(Object endpoint, MessageAddressingProperties requestMap) {
URI requestAction = requestMap.getAction();
if (requestAction != null) {
- return URI.create(requestAction.toString() + getOutputActionSuffix());
+ return URI.create(requestAction + getOutputActionSuffix());
} else {
return null;
}
@@ -231,7 +226,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
protected URI getDefaultFaultAction(Object endpoint, MessageAddressingProperties requestMap) {
URI requestAction = requestMap.getAction();
if (requestAction != null) {
- return URI.create(requestAction.toString() + getFaultActionSuffix());
+ return URI.create(requestAction + getFaultActionSuffix());
} else {
return null;
}
@@ -257,7 +252,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
/**
* Sets the suffix to add to request <code>Action</code>s for reply messages.
*
- * @see #DEFAULT_OUTPUT_ACTION_SUFFIX
+ * @see org.springframework.ws.soap.addressing.server.AbstractActionEndpointMapping#DEFAULT_OUTPUT_ACTION_SUFFIX
*/
public void setOutputActionSuffix(String outputActionSuffix) {
Assert.hasText(outputActionSuffix, "'outputActionSuffix' must not be empty");
@@ -274,7 +269,7 @@ public class WSACamelEndpointMapping extends AbstractAddressingEndpointMapping i
/**
* Sets the suffix to add to request <code>Action</code>s for reply fault messages.
*
- * @see #DEFAULT_FAULT_ACTION_SUFFIX
+ * @see org.springframework.ws.soap.addressing.server.AbstractActionEndpointMapping#DEFAULT_FAULT_ACTION_SUFFIX
*/
public void setFaultActionSuffix(String faultActionSuffix) {
Assert.hasText(faultActionSuffix, "'faultActionSuffix' must not be empty");
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/converter/StringSourceConverter.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/converter/StringSourceConverter.java
index 0fbba0eb0e2..7f8cac4e527 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/converter/StringSourceConverter.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/converter/StringSourceConverter.java
@@ -28,7 +28,7 @@ import org.apache.camel.util.xml.StringSource;
* {@link org.springframework.xml.transform.StringSource} implementations, this converter handles these (corner)cases.
* <p/>
* Note that conversion options are limited by Spring's {@link org.springframework.xml.transform.StringSource} since
- * it's the most simple one. It has just one constructor that accepts a String as input.
+ * it's the simplest one. It has just one constructor that accepts a String as input.
*/
@Converter(generateLoader = true)
public final class StringSourceConverter {
@@ -37,8 +37,7 @@ public final class StringSourceConverter {
}
/**
- * Converts a Spring-WS {@link org.springframework.xml.transform.StringSource} to a Camel
- * {@link org.apache.camel.converter.jaxp.StringSource}
+ * Converts a Spring-WS {@link org.springframework.xml.transform.StringSource} to a Camel {@link StringSource}
*/
@Converter
public static StringSource toStringSourceFromSpring(org.springframework.xml.transform.StringSource springStringSource) {
@@ -46,8 +45,7 @@ public final class StringSourceConverter {
}
/**
- * Converts a Camel {@link org.apache.camel.converter.jaxp.StringSource} to a Spring-WS
- * {@link org.springframework.xml.transform.StringSource}
+ * Converts a Camel {@link StringSource} to a Spring-WS {@link org.springframework.xml.transform.StringSource}
*/
@Converter
public static org.springframework.xml.transform.StringSource toStringSourceFromCamel(StringSource camelStringSource) {
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilter.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilter.java
index ad624eb87de..9539a26987d 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilter.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilter.java
@@ -64,8 +64,7 @@ public class BasicMessageFilter implements MessageFilter {
*/
protected void processHeaderAndAttachments(AttachmentMessage inOrOut, WebServiceMessage response) {
- if (response instanceof SoapMessage) {
- SoapMessage soapMessage = (SoapMessage) response;
+ if (response instanceof SoapMessage soapMessage) {
processSoapHeader(inOrOut, soapMessage);
doProcessSoapAttachments(inOrOut, soapMessage);
}
@@ -117,8 +116,8 @@ public class BasicMessageFilter implements MessageFilter {
}
Object value = headers.get(name);
- if (value instanceof QName) {
- soapHeader.addHeaderElement((QName) value);
+ if (value instanceof QName qname) {
+ soapHeader.addHeaderElement(qname);
} else {
if (value instanceof String) {
soapHeader.addAttribute(new QName(name), value + "");
@@ -128,7 +127,7 @@ public class BasicMessageFilter implements MessageFilter {
}
/**
- * Populate SOAP attachments from in or out exchange message. This the convenient method for overriding.
+ * Populate SOAP attachments from in or out an exchange message. This the convenient method for overriding.
*/
protected void doProcessSoapAttachments(AttachmentMessage inOrOut, SoapMessage response) {
if (inOrOut.hasAttachments()) {
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/HeaderTransformationMessageFilter.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/HeaderTransformationMessageFilter.java
index 89cf7d34c59..7a927a3ad5b 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/HeaderTransformationMessageFilter.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/HeaderTransformationMessageFilter.java
@@ -80,8 +80,7 @@ public class HeaderTransformationMessageFilter implements MessageFilter {
* Transform the header
*/
private void processHeader(CamelContext context, Message inOrOut, WebServiceMessage webServiceMessage) {
- if (webServiceMessage instanceof SoapMessage) {
- SoapMessage soapMessage = (SoapMessage) webServiceMessage;
+ if (webServiceMessage instanceof SoapMessage soapMessage) {
try {
XsltUriResolver resolver = new XsltUriResolver(context, xslt);
Source stylesheetResource = resolver.resolve(xslt, null);
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingType.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingType.java
index 61ca5a0f315..c76d7a95a01 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingType.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingType.java
@@ -43,7 +43,7 @@ public enum EndpointMappingType {
* Find {@link EndpointMappingType} that corresponds with the prefix of the given uri. Matching of uri prefix
* against enum values is case-insensitive
*
- * @param uri remaining uri part of Spring-WS component
+ * @param uri remaining uri part of the Spring-WS component
* @return EndpointMappingType corresponding to uri prefix
*/
public static EndpointMappingType getTypeFromUriPrefix(String uri) {
diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderManualTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderManualTest.java
index 58bdd546cb5..e24cdc6f6ab 100644
--- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderManualTest.java
+++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderManualTest.java
@@ -49,7 +49,7 @@ public class ProducerWss4JSecurityHeaderManualTest extends CamelSpringTestSuppor
}
@Test
- public void testResponseUsingWss4jSampleInterceptorWithoutHeadersRemoved() throws Exception {
+ public void testResponseUsingWss4jSampleInterceptorWithoutHeadersRemoved() {
setRemoveHeaders(false);
@@ -63,7 +63,7 @@ public class ProducerWss4JSecurityHeaderManualTest extends CamelSpringTestSuppor
}
@Test
- public void testResponseUsingWss4jSampleInterceptorWithHeadersRemoved() throws Exception {
+ public void testResponseUsingWss4jSampleInterceptorWithHeadersRemoved() {
setRemoveHeaders(true);
@@ -78,10 +78,10 @@ public class ProducerWss4JSecurityHeaderManualTest extends CamelSpringTestSuppor
private PlusResponse createSampleRequestResponsePair() {
PlusRequest request = new PlusRequest();
- request.setA(Integer.valueOf(1));
- request.setB(Integer.valueOf(2));
+ request.setA(1);
+ request.setB(2);
- PlusResponse result = (PlusResponse) template.requestBody("direct:testHeader", request);
+ PlusResponse result = template.requestBody("direct:testHeader", request, PlusResponse.class);
return result;
}
@@ -90,9 +90,7 @@ public class ProducerWss4JSecurityHeaderManualTest extends CamelSpringTestSuppor
ClientInterceptor[] clientInterceptors = webServiceTemplate.getInterceptors();
for (ClientInterceptor clientInterceptor : clientInterceptors) {
- if (clientInterceptor instanceof Wss4jSecurityInterceptor) {
- Wss4jSecurityInterceptor wss4jSampleInterceptor
- = (Wss4jSecurityInterceptor) clientInterceptor;
+ if (clientInterceptor instanceof Wss4jSecurityInterceptor wss4jSampleInterceptor) {
wss4jSampleInterceptor.setRemoveSecurityHeader(isRemoved);
}
}