#1160 - Update code style.
This commit is contained in:
18
pom.xml
18
pom.xml
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
@@ -346,7 +346,7 @@
|
||||
</excludes>
|
||||
<searchTransitive>true</searchTransitive>
|
||||
</bannedDependencies>
|
||||
<dependencyConvergence />
|
||||
<dependencyConvergence/>
|
||||
</rules>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
@@ -696,9 +696,13 @@
|
||||
<configuration>
|
||||
<tasks>
|
||||
<zip destfile="${project.build.directory}/${project.artifactId}-${project.version}.zip">
|
||||
<zipfileset src="${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar" prefix="api" />
|
||||
<zipfileset dir="${project.build.directory}/site/reference/html" prefix="reference" />
|
||||
<zipfileset dir="${project.build.directory}/generated-docs" includes="index.pdf" />
|
||||
<zipfileset
|
||||
src="${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar"
|
||||
prefix="api"/>
|
||||
<zipfileset dir="${project.build.directory}/site/reference/html"
|
||||
prefix="reference"/>
|
||||
<zipfileset dir="${project.build.directory}/generated-docs"
|
||||
includes="index.pdf"/>
|
||||
</zip>
|
||||
</tasks>
|
||||
</configuration>
|
||||
@@ -719,7 +723,9 @@
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
|
||||
<file>
|
||||
${project.build.directory}/${project.artifactId}-${project.version}.zip
|
||||
</file>
|
||||
<type>zip;zip.type=docs;zip.deployed=false</type>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.ws;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Sub-interface of {@link WebServiceMessage} that can contain special Fault messages. Fault messages (such as {@link
|
||||
* org.springframework.ws.soap.SoapFault} SOAP Faults) often require different processing rules.
|
||||
* Sub-interface of {@link WebServiceMessage} that can contain special Fault messages. Fault messages (such as
|
||||
* {@link org.springframework.ws.soap.SoapFault} SOAP Faults) often require different processing rules.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.soap.SoapMessage
|
||||
@@ -41,7 +41,6 @@ public interface FaultAwareWebServiceMessage extends WebServiceMessage {
|
||||
*/
|
||||
QName getFaultCode();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the fault reason message.
|
||||
*
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class WebServiceException extends NestedRuntimeException {
|
||||
* Create a new instance of the {@code WebServiceException} class.
|
||||
*
|
||||
* @param msg the detail message
|
||||
* @param ex the root {@link Throwable exception}
|
||||
* @param ex the root {@link Throwable exception}
|
||||
*/
|
||||
public WebServiceException(String msg, Throwable ex) {
|
||||
super(msg, ex);
|
||||
|
||||
@@ -18,13 +18,14 @@ package org.springframework.ws;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
/**
|
||||
* Represents a protocol-agnostic XML message.
|
||||
*
|
||||
* <p>Contains methods that provide access to the payload of the message.
|
||||
* <p>
|
||||
* Contains methods that provide access to the payload of the message.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.soap.SoapMessage
|
||||
@@ -35,9 +36,8 @@ public interface WebServiceMessage {
|
||||
|
||||
/**
|
||||
* Returns the contents of the message as a {@link Source}.
|
||||
*
|
||||
* <p>Depending on the implementation, this can be retrieved multiple times, or just
|
||||
* a single time.
|
||||
* <p>
|
||||
* Depending on the implementation, this can be retrieved multiple times, or just a single time.
|
||||
*
|
||||
* @return the message contents
|
||||
*/
|
||||
@@ -45,10 +45,10 @@ public interface WebServiceMessage {
|
||||
|
||||
/**
|
||||
* Returns the contents of the message as a {@link Result}.
|
||||
*
|
||||
* <p>Calling this method removes the current payload.
|
||||
*
|
||||
* <p>Implementations that are read-only will throw an {@link UnsupportedOperationException}.
|
||||
* <p>
|
||||
* Calling this method removes the current payload.
|
||||
* <p>
|
||||
* Implementations that are read-only will throw an {@link UnsupportedOperationException}.
|
||||
*
|
||||
* @return the message contents
|
||||
* @throws UnsupportedOperationException if the message is read-only
|
||||
@@ -56,8 +56,10 @@ public interface WebServiceMessage {
|
||||
Result getPayloadResult();
|
||||
|
||||
/**
|
||||
* Writes the entire message to the given output stream. <p>If the given stream is an instance of {@link
|
||||
* org.springframework.ws.transport.TransportOutputStream}, the corresponding headers will be written as well.
|
||||
* Writes the entire message to the given output stream.
|
||||
* <p>
|
||||
* If the given stream is an instance of {@link org.springframework.ws.transport.TransportOutputStream}, the
|
||||
* corresponding headers will be written as well.
|
||||
*
|
||||
* @param outputStream the stream to write to
|
||||
* @throws IOException if an I/O exception occurs
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.io.InputStream;
|
||||
/**
|
||||
* The {@code WebServiceMessageFactory} serves as a factory for {@link org.springframework.ws.WebServiceMessage
|
||||
* WebServiceMessages}.
|
||||
*
|
||||
* <p>Allows the creation of empty messages, or messages based on {@code InputStream}s.
|
||||
* <p>
|
||||
* Allows the creation of empty messages, or messages based on {@code InputStream}s.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.WebServiceMessage
|
||||
@@ -40,8 +40,8 @@ public interface WebServiceMessageFactory {
|
||||
|
||||
/**
|
||||
* Reads a {@link WebServiceMessage} from the given input stream.
|
||||
*
|
||||
* <p>If the given stream is an instance of {@link org.springframework.ws.transport.TransportInputStream
|
||||
* <p>
|
||||
* If the given stream is an instance of {@link org.springframework.ws.transport.TransportInputStream
|
||||
* TransportInputStream}, the headers will be read from the request.
|
||||
*
|
||||
* @param inputStream the input stream to read the message from
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class WebServiceClientException extends WebServiceException {
|
||||
* Create a new instance of the {@code WebServiceClientException} class.
|
||||
*
|
||||
* @param msg the detail message
|
||||
* @param ex the root {@link Throwable exception}
|
||||
* @param ex the root {@link Throwable exception}
|
||||
*/
|
||||
public WebServiceClientException(String msg, Throwable ex) {
|
||||
super(msg, ex);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WebServiceIOException extends WebServiceClientException {
|
||||
* Create a new instance of the {@code WebServiceIOException} class.
|
||||
*
|
||||
* @param msg the detail message
|
||||
* @param ex the root {@link IOException}
|
||||
* @param ex the root {@link IOException}
|
||||
*/
|
||||
public WebServiceIOException(String msg, IOException ex) {
|
||||
super(msg, ex);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WebServiceTransformerException extends WebServiceClientException {
|
||||
* Create a new instance of the {@code WebServiceTransformerException} class.
|
||||
*
|
||||
* @param msg the detail message
|
||||
* @param ex the root {@link Throwable exception}
|
||||
* @param ex the root {@link Throwable exception}
|
||||
*/
|
||||
public WebServiceTransformerException(String msg, TransformerException ex) {
|
||||
super(msg, ex);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WebServiceTransportException extends WebServiceIOException {
|
||||
* Create a new instance of the {@code WebServiceTransportException} class.
|
||||
*
|
||||
* @param msg the detail message
|
||||
* @param ex the root {@link TransportException}
|
||||
* @param ex the root {@link TransportException}
|
||||
*/
|
||||
public WebServiceTransportException(String msg, TransportException ex) {
|
||||
super(msg, ex);
|
||||
|
||||
@@ -34,8 +34,7 @@ public class SimpleFaultMessageResolver implements FaultMessageResolver {
|
||||
public void resolveFault(WebServiceMessage message) {
|
||||
if (message instanceof FaultAwareWebServiceMessage) {
|
||||
throw new WebServiceFaultException((FaultAwareWebServiceMessage) message);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new WebServiceFaultException("Message has unknown fault: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,19 @@
|
||||
package org.springframework.ws.client.core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
/**
|
||||
* Callback interface for extracting a result object from a {@link javax.xml.transform.Source} instance.
|
||||
*
|
||||
* <p>Used for output object creation in {@link WebServiceTemplate}. Alternatively, output sources can also be returned to
|
||||
* <p>
|
||||
* Used for output object creation in {@link WebServiceTemplate}. Alternatively, output sources can also be returned to
|
||||
* client code as-is. In case of a source as execution result, you will almost always want to implement a
|
||||
* {@code SourceExtractor}, to be able to read the message content in a managed fashion, with the connection still
|
||||
* open while reading the message.
|
||||
*
|
||||
* <p>Implementations of this interface perform the actual work of extracting results, but don't need to worry about
|
||||
* {@code SourceExtractor}, to be able to read the message content in a managed fashion, with the connection still open
|
||||
* while reading the message.
|
||||
* <p>
|
||||
* Implementations of this interface perform the actual work of extracting results, but don't need to worry about
|
||||
* exception handling, or resource handling.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -41,8 +42,8 @@ public interface SourceExtractor<T> {
|
||||
* Process the data in the given {@code Source}, creating a corresponding result object.
|
||||
*
|
||||
* @param source the message payload to extract data from
|
||||
* @return an arbitrary result object, or {@code null} if none (the extractor will typically be stateful in the
|
||||
* latter case)
|
||||
* @return an arbitrary result object, or {@code null} if none (the extractor will typically be stateful in the latter
|
||||
* case)
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
T extractData(Source source) throws IOException, TransformerException;
|
||||
|
||||
@@ -17,14 +17,15 @@
|
||||
package org.springframework.ws.client.core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
|
||||
/**
|
||||
* Generic callback interface for code that operates on a {@link WebServiceMessage}.
|
||||
*
|
||||
* <p>Implementations can execute any number of operations on the message, such as set the contents of the message, or set
|
||||
* <p>
|
||||
* Implementations can execute any number of operations on the message, such as set the contents of the message, or set
|
||||
* the {@code SOAPAction} header.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -36,7 +37,7 @@ public interface WebServiceMessageCallback {
|
||||
* Execute any number of operations on the supplied {@code message}.
|
||||
*
|
||||
* @param message the message
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws TransformerException in case of transformation errors
|
||||
*/
|
||||
void doWithMessage(WebServiceMessage message) throws IOException, TransformerException;
|
||||
|
||||
@@ -17,19 +17,20 @@
|
||||
package org.springframework.ws.client.core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
|
||||
/**
|
||||
* Callback interface for extracting a result object from a {@link WebServiceMessage} instance.
|
||||
*
|
||||
* <p>Used for output object creation in {@link WebServiceTemplate}. Alternatively, output messages can also be returned to
|
||||
* <p>
|
||||
* Used for output object creation in {@link WebServiceTemplate}. Alternatively, output messages can also be returned to
|
||||
* client code as-is. In case of a message as execution result, you will almost always want to implement a
|
||||
* {@code WebServiceMessageExtractor}, to be able to read the message in a managed fashion, with the connection
|
||||
* still open while reading the message.
|
||||
*
|
||||
* <p>Implementations of this interface perform the actual work of extracting results, but don't need to worry about
|
||||
* {@code WebServiceMessageExtractor}, to be able to read the message in a managed fashion, with the connection still
|
||||
* open while reading the message.
|
||||
* <p>
|
||||
* Implementations of this interface perform the actual work of extracting results, but don't need to worry about
|
||||
* exception handling, or resource handling.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -41,9 +42,9 @@ public interface WebServiceMessageExtractor<T> {
|
||||
* Process the data in the given {@code WebServiceMessage}, creating a corresponding result object.
|
||||
*
|
||||
* @param message the message to extract data from (possibly a {@code SoapMessage})
|
||||
* @return an arbitrary result object, or {@code null} if none (the extractor will typically be stateful in the
|
||||
* latter case)
|
||||
* @throws IOException in case of I/O errors
|
||||
* @return an arbitrary result object, or {@code null} if none (the extractor will typically be stateful in the latter
|
||||
* case)
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws TransformerException in case of transformation errors
|
||||
*/
|
||||
T extractData(WebServiceMessage message) throws IOException, TransformerException;
|
||||
|
||||
@@ -35,10 +35,10 @@ public interface WebServiceOperations {
|
||||
/**
|
||||
* Sends a web service message that can be manipulated with the given callback, reading the result with a
|
||||
* {@code WebServiceMessageExtractor}.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code WebServiceMessageExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
@@ -50,23 +50,22 @@ public interface WebServiceOperations {
|
||||
* Sends a web service message that can be manipulated with the given callback, reading the result with a
|
||||
* {@code WebServiceMessageExtractor}.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code WebServiceMessageExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
<T> T sendAndReceive(String uri,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
<T> T sendAndReceive(String uri, WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that can be manipulated with the given request callback, handling the response with a
|
||||
* response callback.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestCallback the callback to be used for manipulating the request message
|
||||
* @param requestCallback the callback to be used for manipulating the request message
|
||||
* @param responseCallback the callback to be used for manipulating the response message
|
||||
* @return {@code true} if a response was received; {@code false} otherwise
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
@@ -78,29 +77,28 @@ public interface WebServiceOperations {
|
||||
* Sends a web service message that can be manipulated with the given request callback, handling the response with a
|
||||
* response callback.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestCallback the callback to be used for manipulating the request message
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestCallback the callback to be used for manipulating the request message
|
||||
* @param responseCallback the callback to be used for manipulating the response message
|
||||
* @return {@code true} if a response was received; {@code false} otherwise
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
boolean sendAndReceive(String uri,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageCallback responseCallback) throws WebServiceClientException;
|
||||
boolean sendAndReceive(String uri, WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageCallback responseCallback) throws WebServiceClientException;
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Convenience methods for sending and receiving marshalled messages
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured
|
||||
* {@code Marshaller}. Returns the unmarshalled payload of the response message, if any.
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured {@code Marshaller}.
|
||||
* Returns the unmarshalled payload of the response message, if any.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @return the unmarshalled payload of the response message, or {@code null} if no response is given
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
* @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
@@ -108,31 +106,30 @@ public interface WebServiceOperations {
|
||||
Object marshalSendAndReceive(Object requestPayload) throws XmlMappingException, WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured
|
||||
* {@code Marshaller}. Returns the unmarshalled payload of the response message, if any.
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured {@code Marshaller}.
|
||||
* Returns the unmarshalled payload of the response message, if any.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @return the unmarshalled payload of the response message, or {@code null} if no response is given
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
* @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
*/
|
||||
Object marshalSendAndReceive(String uri, Object requestPayload)
|
||||
throws XmlMappingException, WebServiceClientException;
|
||||
Object marshalSendAndReceive(String uri, Object requestPayload) throws XmlMappingException, WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured
|
||||
* {@code Marshaller}. Returns the unmarshalled payload of the response message, if any. The given callback
|
||||
* allows changing of the request message after the payload has been marshalled to it.
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured {@code Marshaller}.
|
||||
* Returns the unmarshalled payload of the response message, if any. The given callback allows changing of the request
|
||||
* message after the payload has been marshalled to it.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @return the unmarshalled payload of the response message, or {@code null} if no response is given
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
* @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
@@ -141,15 +138,15 @@ public interface WebServiceOperations {
|
||||
throws XmlMappingException, WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured
|
||||
* {@code Marshaller}. Returns the unmarshalled payload of the response message, if any. The given callback
|
||||
* allows changing of the request message after the payload has been marshalled to it.
|
||||
* Sends a web service message that contains the given payload, marshalled by the configured {@code Marshaller}.
|
||||
* Returns the unmarshalled payload of the response message, if any. The given callback allows changing of the request
|
||||
* message after the payload has been marshalled to it.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the object to marshal into the request message payload
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @return the unmarshalled payload of the response message, or {@code null} if no response is given
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws XmlMappingException if there is a problem marshalling or unmarshalling
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
* @see WebServiceTemplate#setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see WebServiceTemplate#setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
@@ -157,82 +154,75 @@ public interface WebServiceOperations {
|
||||
Object marshalSendAndReceive(String uri, Object requestPayload, WebServiceMessageCallback requestCallback)
|
||||
throws XmlMappingException, WebServiceClientException;
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Convenience methods for sending Sources
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, reading the result with a
|
||||
* {@code SourceExtractor}.
|
||||
* Sends a web service message that contains the given payload, reading the result with a {@code SourceExtractor}.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code SourceExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
<T> T sendSourceAndReceive(Source requestPayload, SourceExtractor<T> responseExtractor)
|
||||
throws WebServiceClientException;
|
||||
throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, reading the result with a
|
||||
* {@code SourceExtractor}.
|
||||
* Sends a web service message that contains the given payload, reading the result with a {@code SourceExtractor}.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code SourceExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
<T> T sendSourceAndReceive(String uri, Source requestPayload, SourceExtractor<T> responseExtractor)
|
||||
throws WebServiceClientException;
|
||||
throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, reading the result with a
|
||||
* {@code SourceExtractor}.
|
||||
* Sends a web service message that contains the given payload, reading the result with a {@code SourceExtractor}.
|
||||
* <p>
|
||||
* The given callback allows changing of the request message after the payload has been written to it.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code SourceExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
<T> T sendSourceAndReceive(Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
SourceExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
<T> T sendSourceAndReceive(Source requestPayload, WebServiceMessageCallback requestCallback,
|
||||
SourceExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload, reading the result with a
|
||||
* {@code SourceExtractor}.
|
||||
* Sends a web service message that contains the given payload, reading the result with a {@code SourceExtractor}.
|
||||
* <p>
|
||||
* The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* <p>The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code SourceExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
<T> T sendSourceAndReceive(String uri,
|
||||
Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
SourceExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
<T> T sendSourceAndReceive(String uri, Source requestPayload, WebServiceMessageCallback requestCallback,
|
||||
SourceExtractor<T> responseExtractor) throws WebServiceClientException;
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Convenience methods for sending Sources and receiving to Results
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
||||
* {@code Result}.
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param responseResult the result to write the response payload to
|
||||
@@ -245,7 +235,7 @@ public interface WebServiceOperations {
|
||||
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
||||
* {@code Result}.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param responseResult the result to write the response payload to
|
||||
* @return {@code true} if a response was received; {@code false} otherwise
|
||||
@@ -257,37 +247,34 @@ public interface WebServiceOperations {
|
||||
/**
|
||||
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
||||
* {@code Result}.
|
||||
* <p>
|
||||
* The given callback allows changing of the request message after the payload has been written to it.
|
||||
* <p>
|
||||
* This will only work with a default uri specified!
|
||||
*
|
||||
* <p>The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* <p>This will only work with a default uri specified!
|
||||
*
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param responseResult the result to write the response payload to
|
||||
* @param responseResult the result to write the response payload to
|
||||
* @return {@code true} if a response was received; {@code false} otherwise
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
boolean sendSourceAndReceiveToResult(Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
Result responseResult) throws WebServiceClientException;
|
||||
boolean sendSourceAndReceiveToResult(Source requestPayload, WebServiceMessageCallback requestCallback,
|
||||
Result responseResult) throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Sends a web service message that contains the given payload. Writes the response, if any, to the given
|
||||
* {@code Result}.
|
||||
* <p>
|
||||
* The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* <p>The given callback allows changing of the request message after the payload has been written to it.
|
||||
*
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param uri the URI to send the message to
|
||||
* @param requestPayload the payload of the request message
|
||||
* @param requestCallback callback to change message, can be {@code null}
|
||||
* @param responseResult the result to write the response payload to
|
||||
* @param responseResult the result to write the response payload to
|
||||
* @return {@code true} if a response was received; {@code false} otherwise
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
*/
|
||||
boolean sendSourceAndReceiveToResult(String uri,
|
||||
Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
Result responseResult) throws WebServiceClientException;
|
||||
boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, WebServiceMessageCallback requestCallback,
|
||||
Result responseResult) throws WebServiceClientException;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
@@ -28,7 +29,6 @@ import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
@@ -62,38 +62,48 @@ import org.springframework.ws.transport.support.TransportUtils;
|
||||
/**
|
||||
* <strong>The central class for client-side Web services.</strong> It provides a message-driven approach to sending and
|
||||
* receiving {@link WebServiceMessage} instances.
|
||||
*
|
||||
* <p>Code using this class need only implement callback interfaces, provide {@link Source} objects to read data from, or
|
||||
* <p>
|
||||
* Code using this class need only implement callback interfaces, provide {@link Source} objects to read data from, or
|
||||
* use the pluggable {@link Marshaller} support. For invoking the {@link #marshalSendAndReceive marshalling methods},
|
||||
* the {@link #setMarshaller(Marshaller) marshaller} and {@link #setUnmarshaller(Unmarshaller) unmarshaller} properties
|
||||
* must be set.
|
||||
*
|
||||
* <p>This template uses a {@link SoapFaultMessageResolver} to handle fault response messages. Another {@link
|
||||
* FaultMessageResolver} can be defined with with {@link #setFaultMessageResolver(FaultMessageResolver)
|
||||
* <p>
|
||||
* This template uses a {@link SoapFaultMessageResolver} to handle fault response messages. Another
|
||||
* {@link FaultMessageResolver} can be defined with with {@link #setFaultMessageResolver(FaultMessageResolver)
|
||||
* faultMessageResolver} property. If this property is set to {@code null}, no fault resolving is performed.
|
||||
*
|
||||
* <p>This template uses the following algorithm for sending and receiving. <ol> <li>Call {@link #createConnection(URI)
|
||||
* createConnection()}.</li> <li>Call {@link WebServiceMessageFactory#createWebServiceMessage()
|
||||
* createWebServiceMessage()} on the registered message factory to create a request message.</li> <li>Invoke {@link
|
||||
* WebServiceMessageCallback#doWithMessage(WebServiceMessage) doWithMessage()} on the request callback, if any. This
|
||||
* step stores content in the request message, based on {@code Source}, marshalling, etc.</li> <li>Invoke {@link
|
||||
* ClientInterceptor#handleRequest(MessageContext) handleRequest()} on the registered {@link
|
||||
* #setInterceptors(ClientInterceptor[]) interceptors}. Interceptors are executed in order. If any of the interceptors
|
||||
* creates a response message in the message context, skip to step 7.</li> <li>Call {@link
|
||||
* WebServiceConnection#send(WebServiceMessage) send()} on the connection.</li> <li>Call {@link
|
||||
* #hasError(WebServiceConnection,WebServiceMessage) hasError()} to check if the connection has an error. For an HTTP
|
||||
* transport, a status code other than {@code 2xx} indicates an error. However, since a status code of 500 can also
|
||||
* indicate a SOAP fault, the template verifies whether the error is not a fault.</li> <ul> <li>If the connection has an
|
||||
* error, call the {@link #handleError handleError()} method, which by default throws a {@link
|
||||
* WebServiceTransportException}.</li> <li>If the connection has no error, continue with the next step.</li> </ul>
|
||||
* <p>
|
||||
* This template uses the following algorithm for sending and receiving.
|
||||
* <ol>
|
||||
* <li>Call {@link #createConnection(URI) createConnection()}.</li>
|
||||
* <li>Call {@link WebServiceMessageFactory#createWebServiceMessage() createWebServiceMessage()} on the registered
|
||||
* message factory to create a request message.</li>
|
||||
* <li>Invoke {@link WebServiceMessageCallback#doWithMessage(WebServiceMessage) doWithMessage()} on the request
|
||||
* callback, if any. This step stores content in the request message, based on {@code Source}, marshalling, etc.</li>
|
||||
* <li>Invoke {@link ClientInterceptor#handleRequest(MessageContext) handleRequest()} on the registered
|
||||
* {@link #setInterceptors(ClientInterceptor[]) interceptors}. Interceptors are executed in order. If any of the
|
||||
* interceptors creates a response message in the message context, skip to step 7.</li>
|
||||
* <li>Call {@link WebServiceConnection#send(WebServiceMessage) send()} on the connection.</li>
|
||||
* <li>Call {@link #hasError(WebServiceConnection,WebServiceMessage) hasError()} to check if the connection has an
|
||||
* error. For an HTTP transport, a status code other than {@code 2xx} indicates an error. However, since a status code
|
||||
* of 500 can also indicate a SOAP fault, the template verifies whether the error is not a fault.</li>
|
||||
* <ul>
|
||||
* <li>If the connection has an error, call the {@link #handleError handleError()} method, which by default throws a
|
||||
* {@link WebServiceTransportException}.</li>
|
||||
* <li>If the connection has no error, continue with the next step.</li>
|
||||
* </ul>
|
||||
* <li>Invoke {@link WebServiceConnection#receive(WebServiceMessageFactory) receive} on the connection to read the
|
||||
* response message, if any.</li> <ul> <li>If no response was received, return {@code null} or
|
||||
* {@code false}</li> <li>Call {@link #hasFault(WebServiceConnection,WebServiceMessage) hasFault()} to determine
|
||||
* whether the response has a fault. If it has, call {@link ClientInterceptor#handleFault(MessageContext)} and the
|
||||
* {@link #handleFault handleFault()} method.</li> <li>Otherwise, invoke {@link ClientInterceptor#handleResponse(MessageContext)}
|
||||
* and {@link WebServiceMessageExtractor#extractData(WebServiceMessage) extractData()} on the response extractor, or
|
||||
* {@link WebServiceMessageCallback#doWithMessage(WebServiceMessage) doWithMessage} on the response callback.</li> </ul>
|
||||
* <li>Call to {@link WebServiceConnection#close() close} on the connection.</li> </ol>
|
||||
* response message, if any.</li>
|
||||
* <ul>
|
||||
* <li>If no response was received, return {@code null} or {@code false}</li>
|
||||
* <li>Call {@link #hasFault(WebServiceConnection,WebServiceMessage) hasFault()} to determine whether the response has a
|
||||
* fault. If it has, call {@link ClientInterceptor#handleFault(MessageContext)} and the {@link #handleFault
|
||||
* handleFault()} method.</li>
|
||||
* <li>Otherwise, invoke {@link ClientInterceptor#handleResponse(MessageContext)} and
|
||||
* {@link WebServiceMessageExtractor#extractData(WebServiceMessage) extractData()} on the response extractor, or
|
||||
* {@link WebServiceMessageCallback#doWithMessage(WebServiceMessage) doWithMessage} on the response callback.</li>
|
||||
* </ul>
|
||||
* <li>Call to {@link WebServiceConnection#close() close} on the connection.</li>
|
||||
* </ol>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
@@ -104,12 +114,12 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
public static final String MESSAGE_TRACING_LOG_CATEGORY = "org.springframework.ws.client.MessageTracing";
|
||||
|
||||
/** Additional logger to use for sent message tracing. */
|
||||
protected static final Log sentMessageTracingLogger =
|
||||
LogFactory.getLog(WebServiceTemplate.MESSAGE_TRACING_LOG_CATEGORY + ".sent");
|
||||
protected static final Log sentMessageTracingLogger = LogFactory
|
||||
.getLog(WebServiceTemplate.MESSAGE_TRACING_LOG_CATEGORY + ".sent");
|
||||
|
||||
/** Additional logger to use for received message tracing. */
|
||||
protected static final Log receivedMessageTracingLogger =
|
||||
LogFactory.getLog(WebServiceTemplate.MESSAGE_TRACING_LOG_CATEGORY + ".received");
|
||||
protected static final Log receivedMessageTracingLogger = LogFactory
|
||||
.getLog(WebServiceTemplate.MESSAGE_TRACING_LOG_CATEGORY + ".received");
|
||||
|
||||
private Marshaller marshaller;
|
||||
|
||||
@@ -141,26 +151,24 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code WebServiceTemplate} with the given marshaller. If the given {@link
|
||||
* Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
|
||||
* unmarshalling. Otherwise, an exception is thrown.
|
||||
*
|
||||
* <p>Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface,
|
||||
* so that you can safely use this constructor.
|
||||
* Creates a new {@code WebServiceTemplate} with the given marshaller. If the given {@link Marshaller} also implements
|
||||
* the {@link Unmarshaller} interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is
|
||||
* thrown.
|
||||
* <p>
|
||||
* Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface, so
|
||||
* that you can safely use this constructor.
|
||||
*
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller}
|
||||
* interface
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller} interface
|
||||
* @since 2.0.3
|
||||
*/
|
||||
public WebServiceTemplate(Marshaller marshaller) {
|
||||
Assert.notNull(marshaller, "marshaller must not be null");
|
||||
if (!(marshaller instanceof Unmarshaller)) {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller " +
|
||||
"interface. Please set an Unmarshaller explicitly by using the " +
|
||||
"WebServiceTemplate(Marshaller, Unmarshaller) constructor.");
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller "
|
||||
+ "interface. Please set an Unmarshaller explicitly by using the "
|
||||
+ "WebServiceTemplate(Marshaller, Unmarshaller) constructor.");
|
||||
} else {
|
||||
this.setMarshaller(marshaller);
|
||||
this.setUnmarshaller((Unmarshaller) marshaller);
|
||||
}
|
||||
@@ -170,7 +178,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
/**
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter} with the given marshaller and unmarshaller.
|
||||
*
|
||||
* @param marshaller the marshaller to use
|
||||
* @param marshaller the marshaller to use
|
||||
* @param unmarshaller the unmarshaller to use
|
||||
* @since 2.0.3
|
||||
*/
|
||||
@@ -187,16 +195,15 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
if (destinationProvider != null) {
|
||||
URI uri = destinationProvider.getDestination();
|
||||
return uri != null ? uri.toString() : null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default URI to be used on operations that do not have a URI parameter.
|
||||
*
|
||||
* <p>Typically, either this property is set, or {@link #setDestinationProvider(DestinationProvider)}, but not both.
|
||||
* <p>
|
||||
* Typically, either this property is set, or {@link #setDestinationProvider(DestinationProvider)}, but not both.
|
||||
*
|
||||
* @see #marshalSendAndReceive(Object)
|
||||
* @see #marshalSendAndReceive(Object,WebServiceMessageCallback)
|
||||
@@ -222,8 +229,8 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Set the destination provider URI to be used on operations that do not have a URI parameter.
|
||||
*
|
||||
* <p>Typically, either this property is set, or {@link #setDefaultUri(String)}, but not both.
|
||||
* <p>
|
||||
* Typically, either this property is set, or {@link #setDefaultUri(String)}, but not both.
|
||||
*
|
||||
* @see #marshalSendAndReceive(Object)
|
||||
* @see #marshalSendAndReceive(Object,WebServiceMessageCallback)
|
||||
@@ -264,8 +271,8 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Sets the fault resolver for this template. Default is the
|
||||
* {@link org.springframework.ws.soap.client.core.SoapFaultMessageResolver SoapFaultMessageResolver}, but may be
|
||||
* set to {@code null} to disable fault handling.
|
||||
* {@link org.springframework.ws.soap.client.core.SoapFaultMessageResolver SoapFaultMessageResolver}, but may be set
|
||||
* to {@code null} to disable fault handling.
|
||||
*/
|
||||
public void setFaultMessageResolver(FaultMessageResolver faultMessageResolver) {
|
||||
this.faultMessageResolver = faultMessageResolver;
|
||||
@@ -273,37 +280,35 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Indicates whether the {@linkplain WebServiceConnection#hasError() connection} should be checked for error
|
||||
* indicators ({@code true}), or whether these should be ignored ({@code false}). The default is
|
||||
* {@code true}.
|
||||
*
|
||||
* <p>When using an HTTP transport, this property defines whether to check the HTTP response status code is in the 2xx
|
||||
* indicators ({@code true}), or whether these should be ignored ({@code false}). The default is {@code true}.
|
||||
* <p>
|
||||
* When using an HTTP transport, this property defines whether to check the HTTP response status code is in the 2xx
|
||||
* Successful range. Both the SOAP specification and the WS-I Basic Profile define that a Web service must return a
|
||||
* "200 OK" or "202 Accepted" HTTP status code for a normal response. Setting this property to {@code false}
|
||||
* allows this template to deal with non-conforming services.
|
||||
* "200 OK" or "202 Accepted" HTTP status code for a normal response. Setting this property to {@code false} allows
|
||||
* this template to deal with non-conforming services.
|
||||
*
|
||||
* @see #hasError(WebServiceConnection, WebServiceMessage)
|
||||
* @see <a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383529">SOAP 1.1 specification</a>
|
||||
* @see <a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html#HTTP_Success_Status_Codes">WS-I Basic
|
||||
* Profile</a>
|
||||
* @see <a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html#HTTP_Success_Status_Codes">WS-I Basic Profile</a>
|
||||
*/
|
||||
public void setCheckConnectionForError(boolean checkConnectionForError) {
|
||||
this.checkConnectionForError = checkConnectionForError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the {@linkplain FaultAwareWebServiceConnection#hasFault() connection} should be checked for
|
||||
* fault indicators ({@code true}), or whether we should rely on the {@link
|
||||
* FaultAwareWebServiceMessage#hasFault() message} only ({@code false}). The default is {@code true}.
|
||||
*
|
||||
* <p>When using an HTTP transport, this property defines whether to check the HTTP response status code for fault
|
||||
* Indicates whether the {@linkplain FaultAwareWebServiceConnection#hasFault() connection} should be checked for fault
|
||||
* indicators ({@code true}), or whether we should rely on the {@link FaultAwareWebServiceMessage#hasFault() message}
|
||||
* only ({@code false}). The default is {@code true}.
|
||||
* <p>
|
||||
* When using an HTTP transport, this property defines whether to check the HTTP response status code for fault
|
||||
* indicators. Both the SOAP specification and the WS-I Basic Profile define that a Web service must return a "500
|
||||
* Internal Server Error" HTTP status code if the response envelope is a Fault. Setting this property to
|
||||
* {@code false} allows this template to deal with non-conforming services.
|
||||
* Internal Server Error" HTTP status code if the response envelope is a Fault. Setting this property to {@code false}
|
||||
* allows this template to deal with non-conforming services.
|
||||
*
|
||||
* @see #hasFault(WebServiceConnection,WebServiceMessage)
|
||||
* @see <a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383529">SOAP 1.1 specification</a>
|
||||
* @see <a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html#HTTP_Server_Error_Status_Codes">WS-I Basic
|
||||
* Profile</a>
|
||||
* Profile</a>
|
||||
*/
|
||||
public void setCheckConnectionForFault(boolean checkConnectionForFault) {
|
||||
this.checkConnectionForFault = checkConnectionForFault;
|
||||
@@ -328,8 +333,8 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the default implementations for the template's strategies: {@link SoapFaultMessageResolver}, {@link
|
||||
* org.springframework.ws.soap.saaj.SaajSoapMessageFactory}, and {@link HttpUrlConnectionMessageSender}.
|
||||
* Initialize the default implementations for the template's strategies: {@link SoapFaultMessageResolver},
|
||||
* {@link org.springframework.ws.soap.saaj.SaajSoapMessageFactory}, and {@link HttpUrlConnectionMessageSender}.
|
||||
*
|
||||
* @throws BeanInitializationException in case of initalization errors
|
||||
* @see #setFaultMessageResolver(FaultMessageResolver)
|
||||
@@ -384,17 +389,15 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object marshalSendAndReceive(String uri,
|
||||
final Object requestPayload,
|
||||
final WebServiceMessageCallback requestCallback) {
|
||||
public Object marshalSendAndReceive(String uri, final Object requestPayload,
|
||||
final WebServiceMessageCallback requestCallback) {
|
||||
return sendAndReceive(uri, new WebServiceMessageCallback() {
|
||||
|
||||
public void doWithMessage(WebServiceMessage request) throws IOException, TransformerException {
|
||||
if (requestPayload != null) {
|
||||
Marshaller marshaller = getMarshaller();
|
||||
if (marshaller == null) {
|
||||
throw new IllegalStateException(
|
||||
"No marshaller registered. Check configuration of WebServiceTemplate.");
|
||||
throw new IllegalStateException("No marshaller registered. Check configuration of WebServiceTemplate.");
|
||||
}
|
||||
MarshallingUtils.marshal(marshaller, requestPayload, request);
|
||||
if (requestCallback != null) {
|
||||
@@ -407,8 +410,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
public Object extractData(WebServiceMessage response) throws IOException {
|
||||
Unmarshaller unmarshaller = getUnmarshaller();
|
||||
if (unmarshaller == null) {
|
||||
throw new IllegalStateException(
|
||||
"No unmarshaller registered. Check configuration of WebServiceTemplate.");
|
||||
throw new IllegalStateException("No unmarshaller registered. Check configuration of WebServiceTemplate.");
|
||||
}
|
||||
return MarshallingUtils.unmarshal(unmarshaller, response);
|
||||
}
|
||||
@@ -430,17 +432,14 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendSourceAndReceiveToResult(Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
final Result responseResult) {
|
||||
public boolean sendSourceAndReceiveToResult(Source requestPayload, WebServiceMessageCallback requestCallback,
|
||||
final Result responseResult) {
|
||||
return sendSourceAndReceiveToResult(getDefaultUri(), requestPayload, requestCallback, responseResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendSourceAndReceiveToResult(String uri,
|
||||
Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
final Result responseResult) {
|
||||
public boolean sendSourceAndReceiveToResult(String uri, Source requestPayload,
|
||||
WebServiceMessageCallback requestCallback, final Result responseResult) {
|
||||
try {
|
||||
final Transformer transformer = createTransformer();
|
||||
Boolean retVal = doSendAndReceive(uri, transformer, requestPayload, requestCallback,
|
||||
@@ -454,8 +453,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
});
|
||||
return retVal != null && retVal;
|
||||
}
|
||||
catch (TransformerConfigurationException ex) {
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
throw new WebServiceTransformerException("Could not create transformer", ex);
|
||||
}
|
||||
}
|
||||
@@ -470,38 +468,30 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T sendSourceAndReceive(String uri,
|
||||
final Source requestPayload,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
public <T> T sendSourceAndReceive(String uri, final Source requestPayload,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
return sendSourceAndReceive(uri, requestPayload, null, responseExtractor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T sendSourceAndReceive(final Source requestPayload,
|
||||
final WebServiceMessageCallback requestCallback,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
public <T> T sendSourceAndReceive(final Source requestPayload, final WebServiceMessageCallback requestCallback,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
return sendSourceAndReceive(getDefaultUri(), requestPayload, requestCallback, responseExtractor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T sendSourceAndReceive(String uri,
|
||||
final Source requestPayload,
|
||||
final WebServiceMessageCallback requestCallback,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
public <T> T sendSourceAndReceive(String uri, final Source requestPayload,
|
||||
final WebServiceMessageCallback requestCallback, final SourceExtractor<T> responseExtractor) {
|
||||
|
||||
try {
|
||||
return doSendAndReceive(uri, createTransformer(), requestPayload, requestCallback, responseExtractor);
|
||||
}
|
||||
catch (TransformerConfigurationException ex) {
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
throw new WebServiceTransformerException("Could not create transformer", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T doSendAndReceive(String uri,
|
||||
final Transformer transformer,
|
||||
final Source requestPayload,
|
||||
final WebServiceMessageCallback requestCallback,
|
||||
final SourceExtractor<T> responseExtractor) {
|
||||
private <T> T doSendAndReceive(String uri, final Transformer transformer, final Source requestPayload,
|
||||
final WebServiceMessageCallback requestCallback, final SourceExtractor<T> responseExtractor) {
|
||||
Assert.notNull(responseExtractor, "responseExtractor must not be null");
|
||||
return sendAndReceive(uri, new WebServiceMessageCallback() {
|
||||
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
|
||||
@@ -518,15 +508,13 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
//
|
||||
|
||||
@Override
|
||||
public boolean sendAndReceive(WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageCallback responseCallback) {
|
||||
public boolean sendAndReceive(WebServiceMessageCallback requestCallback, WebServiceMessageCallback responseCallback) {
|
||||
return sendAndReceive(getDefaultUri(), requestCallback, responseCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendAndReceive(String uri,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageCallback responseCallback) {
|
||||
public boolean sendAndReceive(String uri, WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageCallback responseCallback) {
|
||||
Assert.notNull(responseCallback, "responseCallback must not be null");
|
||||
Boolean result = sendAndReceive(uri, requestCallback,
|
||||
new WebServiceMessageCallbackMessageExtractor(responseCallback));
|
||||
@@ -535,14 +523,13 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
@Override
|
||||
public <T> T sendAndReceive(WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) {
|
||||
WebServiceMessageExtractor<T> responseExtractor) {
|
||||
return sendAndReceive(getDefaultUri(), requestCallback, responseExtractor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T sendAndReceive(String uriString,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) {
|
||||
public <T> T sendAndReceive(String uriString, WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) {
|
||||
Assert.notNull(responseExtractor, "'responseExtractor' must not be null");
|
||||
Assert.hasLength(uriString, "'uri' must not be empty");
|
||||
TransportContext previousTransportContext = TransportContextHolder.getTransportContext();
|
||||
@@ -553,14 +540,11 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
MessageContext messageContext = new DefaultMessageContext(getMessageFactory());
|
||||
|
||||
return doSendAndReceive(messageContext, connection, requestCallback, responseExtractor);
|
||||
}
|
||||
catch (TransportException ex) {
|
||||
} catch (TransportException ex) {
|
||||
throw new WebServiceTransportException("Could not use transport: " + ex.getMessage(), ex);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
throw new WebServiceIOException("I/O error: " + ex.getMessage(), ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
TransportUtils.closeConnection(connection);
|
||||
TransportContextHolder.setTransportContext(previousTransportContext);
|
||||
}
|
||||
@@ -568,22 +552,20 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Sends and receives a {@link MessageContext}. Sends the {@link MessageContext#getRequest() request message}, and
|
||||
* received to the {@link MessageContext#getResponse() repsonse message}. Invocates the defined {@link
|
||||
* #setInterceptors(ClientInterceptor[]) interceptors} as part of the process.
|
||||
* received to the {@link MessageContext#getResponse() repsonse message}. Invocates the defined
|
||||
* {@link #setInterceptors(ClientInterceptor[]) interceptors} as part of the process.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param connection the connection to use
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param messageContext the message context
|
||||
* @param connection the connection to use
|
||||
* @param requestCallback the requestCallback to be used for manipulating the request message
|
||||
* @param responseExtractor object that will extract results
|
||||
* @return an arbitrary result object, as returned by the {@code WebServiceMessageExtractor}
|
||||
* @throws WebServiceClientException if there is a problem sending or receiving the message
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T> T doSendAndReceive(MessageContext messageContext,
|
||||
WebServiceConnection connection,
|
||||
WebServiceMessageCallback requestCallback,
|
||||
WebServiceMessageExtractor<T> responseExtractor) throws IOException {
|
||||
protected <T> T doSendAndReceive(MessageContext messageContext, WebServiceConnection connection,
|
||||
WebServiceMessageCallback requestCallback, WebServiceMessageExtractor<T> responseExtractor) throws IOException {
|
||||
int interceptorIndex = -1;
|
||||
try {
|
||||
if (requestCallback != null) {
|
||||
@@ -617,28 +599,23 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
triggerHandleResponse(interceptorIndex, messageContext);
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, null);
|
||||
return responseExtractor.extractData(messageContext.getResponse());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
triggerHandleFault(interceptorIndex, messageContext);
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, null);
|
||||
return (T)handleFault(connection, messageContext);
|
||||
return (T) handleFault(connection, messageContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (TransformerException ex) {
|
||||
} catch (TransformerException ex) {
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, ex);
|
||||
throw new WebServiceTransformerException("Transformation error: " + ex.getMessage(), ex);
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
} catch (RuntimeException ex) {
|
||||
// Trigger after-completion for thrown exception.
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, ex);
|
||||
throw ex;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
// Trigger after-completion for thrown exception.
|
||||
triggerAfterCompletion(interceptorIndex, messageContext, ex);
|
||||
throw ex;
|
||||
@@ -651,8 +628,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
request.writeTo(os);
|
||||
sentMessageTracingLogger.trace("Sent request [" + os.toString("UTF-8") + "]");
|
||||
}
|
||||
else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
} else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
sentMessageTracingLogger.debug("Sent request [" + request + "]");
|
||||
}
|
||||
connection.send(request);
|
||||
@@ -660,12 +636,12 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Determines whether the given connection or message context has an error.
|
||||
*
|
||||
* <p>This implementation checks the {@link WebServiceConnection#hasError() connection} first. If it indicates an
|
||||
* error, it makes sure that it is not a {@link FaultAwareWebServiceConnection#hasFault() fault}.
|
||||
* <p>
|
||||
* This implementation checks the {@link WebServiceConnection#hasError() connection} first. If it indicates an error,
|
||||
* it makes sure that it is not a {@link FaultAwareWebServiceConnection#hasFault() fault}.
|
||||
*
|
||||
* @param connection the connection (possibly a {@link FaultAwareWebServiceConnection}
|
||||
* @param request the response message (possibly a {@link FaultAwareWebServiceMessage}
|
||||
* @param request the response message (possibly a {@link FaultAwareWebServiceMessage}
|
||||
* @return {@code true} if the connection has an error; {@code false} otherwise
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
@@ -675,8 +651,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection) {
|
||||
FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
|
||||
return !(faultConnection.hasFault() && request instanceof FaultAwareWebServiceMessage);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -684,13 +659,12 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an error on the given connection. The default implementation throws a {@link
|
||||
* WebServiceTransportException}.
|
||||
* Handles an error on the given connection. The default implementation throws a {@link WebServiceTransportException}.
|
||||
*
|
||||
* @param connection the erroneous connection
|
||||
* @param request the corresponding request message
|
||||
* @return the object to be returned from {@link #sendAndReceive(String,WebServiceMessageCallback,
|
||||
* WebServiceMessageExtractor)}, if any
|
||||
* @param request the corresponding request message
|
||||
* @return the object to be returned from
|
||||
* {@link #sendAndReceive(String,WebServiceMessageCallback, WebServiceMessageExtractor)}, if any
|
||||
*/
|
||||
protected Object handleError(WebServiceConnection connection, WebServiceMessage request) throws IOException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -706,33 +680,28 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
messageContext.getRequest().writeTo(requestStream);
|
||||
ByteArrayOutputStream responseStream = new ByteArrayOutputStream();
|
||||
messageContext.getResponse().writeTo(responseStream);
|
||||
receivedMessageTracingLogger
|
||||
.trace("Received response [" + responseStream.toString("UTF-8") + "] for request [" +
|
||||
requestStream.toString("UTF-8") + "]");
|
||||
receivedMessageTracingLogger.trace("Received response [" + responseStream.toString("UTF-8") + "] for request ["
|
||||
+ requestStream.toString("UTF-8") + "]");
|
||||
} else if (receivedMessageTracingLogger.isDebugEnabled()) {
|
||||
receivedMessageTracingLogger.debug("Received response [" + messageContext.getResponse() + "] for request ["
|
||||
+ messageContext.getRequest() + "]");
|
||||
}
|
||||
else if (receivedMessageTracingLogger.isDebugEnabled()) {
|
||||
receivedMessageTracingLogger
|
||||
.debug("Received response [" + messageContext.getResponse() + "] for request [" +
|
||||
messageContext.getRequest() + "]");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (receivedMessageTracingLogger.isDebugEnabled()) {
|
||||
receivedMessageTracingLogger
|
||||
.debug("Received no response for request [" + messageContext.getRequest() + "]");
|
||||
receivedMessageTracingLogger.debug("Received no response for request [" + messageContext.getRequest() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given connection or message has a fault.
|
||||
*
|
||||
* <p>This implementation checks the {@link FaultAwareWebServiceConnection#hasFault() connection} if the {@link
|
||||
* #setCheckConnectionForFault(boolean) checkConnectionForFault} property is true, and defaults to the {@link
|
||||
* FaultAwareWebServiceMessage#hasFault() message} otherwise.
|
||||
* <p>
|
||||
* This implementation checks the {@link FaultAwareWebServiceConnection#hasFault() connection} if the
|
||||
* {@link #setCheckConnectionForFault(boolean) checkConnectionForFault} property is true, and defaults to the
|
||||
* {@link FaultAwareWebServiceMessage#hasFault() message} otherwise.
|
||||
*
|
||||
* @param connection the connection (possibly a {@link FaultAwareWebServiceConnection}
|
||||
* @param response the response message (possibly a {@link FaultAwareWebServiceMessage}
|
||||
* @param response the response message (possibly a {@link FaultAwareWebServiceMessage}
|
||||
* @return {@code true} if either the connection or the message has a fault; {@code false} otherwise
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
@@ -754,11 +723,10 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose
|
||||
* handleRequest invocation returned {@code true}, in addition to the last interceptor who returned
|
||||
* {@code false}.
|
||||
* handleRequest invocation returned {@code true}, in addition to the last interceptor who returned {@code false}.
|
||||
*
|
||||
* @param interceptorIndex index of last interceptor that was called
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @see ClientInterceptor#handleResponse(MessageContext)
|
||||
* @see ClientInterceptor#handleFault(MessageContext)
|
||||
*/
|
||||
@@ -774,11 +742,10 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
/**
|
||||
* Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose
|
||||
* handleRequest invocation returned {@code true}, in addition to the last interceptor who returned
|
||||
* {@code false}.
|
||||
* handleRequest invocation returned {@code true}, in addition to the last interceptor who returned {@code false}.
|
||||
*
|
||||
* @param interceptorIndex index of last interceptor that was called
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @see ClientInterceptor#handleResponse(MessageContext)
|
||||
* @see ClientInterceptor#handleFault(MessageContext)
|
||||
*/
|
||||
@@ -793,17 +760,16 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger afterCompletion callbacks on the mapped ClientInterceptors. Will just
|
||||
* invoke afterCompletion for all interceptors whose handleRequest invocation has
|
||||
* successfully completed and returned true, in addition to the last interceptor who
|
||||
* returned {@code false}.
|
||||
* Trigger afterCompletion callbacks on the mapped ClientInterceptors. Will just invoke afterCompletion for all
|
||||
* interceptors whose handleRequest invocation has successfully completed and returned true, in addition to the last
|
||||
* interceptor who returned {@code false}.
|
||||
*
|
||||
* @param interceptorIndex index of last interceptor that successfully completed
|
||||
* @param messageContext the message context
|
||||
* @param ex Exception thrown on handler execution, or {@code null} if none
|
||||
* @see ClientInterceptor#afterCompletion
|
||||
*/
|
||||
private void triggerAfterCompletion(int interceptorIndex,
|
||||
MessageContext messageContext, Exception ex)
|
||||
private void triggerAfterCompletion(int interceptorIndex, MessageContext messageContext, Exception ex)
|
||||
throws WebServiceClientException {
|
||||
if (interceptors != null) {
|
||||
for (int i = interceptorIndex; i >= 0; i--) {
|
||||
@@ -813,14 +779,13 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an fault in the given response message. The default implementation invokes the {@link
|
||||
* FaultMessageResolver fault resolver} if registered, or invokes {@link #handleError(WebServiceConnection,
|
||||
* WebServiceMessage)} otherwise.
|
||||
* Handles an fault in the given response message. The default implementation invokes the {@link FaultMessageResolver
|
||||
* fault resolver} if registered, or invokes {@link #handleError(WebServiceConnection, WebServiceMessage)} otherwise.
|
||||
*
|
||||
* @param connection the faulty connection
|
||||
* @param connection the faulty connection
|
||||
* @param messageContext the message context
|
||||
* @return the object to be returned from {@link #sendAndReceive(String,WebServiceMessageCallback,
|
||||
* WebServiceMessageExtractor)}, if any
|
||||
* @return the object to be returned from
|
||||
* {@link #sendAndReceive(String,WebServiceMessageCallback, WebServiceMessageExtractor)}, if any
|
||||
*/
|
||||
protected Object handleFault(WebServiceConnection connection, MessageContext messageContext) throws IOException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -829,8 +794,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
if (getFaultMessageResolver() != null) {
|
||||
getFaultMessageResolver().resolveFault(messageContext.getResponse());
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return handleError(connection, messageContext.getRequest());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.ws.client.core.support;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
@@ -31,18 +30,18 @@ import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
|
||||
/**
|
||||
* Convenient super class for application classes that need Web service access.
|
||||
*
|
||||
* <p>Requires a {@link WebServiceMessageFactory} or a {@link WebServiceTemplate} instance to be set. It will create its
|
||||
* <p>
|
||||
* Requires a {@link WebServiceMessageFactory} or a {@link WebServiceTemplate} instance to be set. It will create its
|
||||
* own {@code WebServiceTemplate} if {@code WebServiceMessageFactory} is passed in.
|
||||
*
|
||||
* <p>In addition to the message factory property, this gateway offers {@link Marshaller} and {@link Unmarshaller}
|
||||
* <p>
|
||||
* In addition to the message factory property, this gateway offers {@link Marshaller} and {@link Unmarshaller}
|
||||
* properties. Setting these is required when the {@link WebServiceTemplate#marshalSendAndReceive(Object) marshalling
|
||||
* methods} of the template are to be used.
|
||||
*
|
||||
* <p>Note that when {@link #setWebServiceTemplate(WebServiceTemplate) injecting a {@code WebServiceTemplate}}
|
||||
* directly, the convenience setters ({@link #setMarshaller(Marshaller)}, {@link #setUnmarshaller(Unmarshaller)}, {@link
|
||||
* #setMessageSender(WebServiceMessageSender)}, {@link #setMessageSenders(WebServiceMessageSender[])}, and {@link
|
||||
* #setDefaultUri(String)}) should not be used on this class, but on the template directly.
|
||||
* <p>
|
||||
* Note that when {@link #setWebServiceTemplate(WebServiceTemplate) injecting a {@code WebServiceTemplate}} directly,
|
||||
* the convenience setters ({@link #setMarshaller(Marshaller)}, {@link #setUnmarshaller(Unmarshaller)},
|
||||
* {@link #setMessageSender(WebServiceMessageSender)}, {@link #setMessageSenders(WebServiceMessageSender[])}, and
|
||||
* {@link #setDefaultUri(String)}) should not be used on this class, but on the template directly.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see #setMessageFactory(WebServiceMessageFactory)
|
||||
@@ -58,8 +57,7 @@ public abstract class WebServiceGatewaySupport implements InitializingBean {
|
||||
private WebServiceTemplate webServiceTemplate;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the {@code WebServiceGatewaySupport} class, with a default
|
||||
* {@code WebServiceTemplate}.
|
||||
* Creates a new instance of the {@code WebServiceGatewaySupport} class, with a default {@code WebServiceTemplate}.
|
||||
*/
|
||||
protected WebServiceGatewaySupport() {
|
||||
webServiceTemplate = new WebServiceTemplate();
|
||||
@@ -126,11 +124,11 @@ public abstract class WebServiceGatewaySupport implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Sets the {@code WebServiceTemplate} to be used by the gateway.
|
||||
*
|
||||
* <p>When using this property, the convenience setters ({@link #setMarshaller(Marshaller)}, {@link
|
||||
* #setUnmarshaller(Unmarshaller)}, {@link #setMessageSender(WebServiceMessageSender)}, {@link
|
||||
* #setMessageSenders(WebServiceMessageSender[])}, and {@link #setDefaultUri(String)}) should not be set on this
|
||||
* class, but on the template directly.
|
||||
* <p>
|
||||
* When using this property, the convenience setters ({@link #setMarshaller(Marshaller)},
|
||||
* {@link #setUnmarshaller(Unmarshaller)}, {@link #setMessageSender(WebServiceMessageSender)},
|
||||
* {@link #setMessageSenders(WebServiceMessageSender[])}, and {@link #setDefaultUri(String)}) should not be set on
|
||||
* this class, but on the template directly.
|
||||
*/
|
||||
public final void setWebServiceTemplate(WebServiceTemplate webServiceTemplate) {
|
||||
Assert.notNull(webServiceTemplate, "'webServiceTemplate' must not be null");
|
||||
@@ -189,7 +187,6 @@ public abstract class WebServiceGatewaySupport implements InitializingBean {
|
||||
*
|
||||
* @throws java.lang.Exception if initialization fails
|
||||
*/
|
||||
protected void initGateway() throws Exception {
|
||||
}
|
||||
protected void initGateway() throws Exception {}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
/**
|
||||
* Base class for {@code WebServiceTemplate} and other WS-accessing helpers. Defines common properties like the
|
||||
* {@link WebServiceMessageFactory} and {@link WebServiceMessageSender}.
|
||||
*
|
||||
* <p>Not intended to be used directly. See {@link org.springframework.ws.client.core.WebServiceTemplate}.
|
||||
* <p>
|
||||
* Not intended to be used directly. See {@link org.springframework.ws.client.core.WebServiceTemplate}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.client.core.WebServiceTemplate
|
||||
@@ -60,20 +60,20 @@ public abstract class WebServiceAccessor extends TransformerObjectSupport implem
|
||||
|
||||
/**
|
||||
* Sets the single message sender used for sending messages.
|
||||
*
|
||||
* <p>This message sender will be used to resolve an URI to a {@link WebServiceConnection}.
|
||||
* <p>
|
||||
* This message sender will be used to resolve an URI to a {@link WebServiceConnection}.
|
||||
*
|
||||
* @see #createConnection(URI)
|
||||
*/
|
||||
public void setMessageSender(WebServiceMessageSender messageSender) {
|
||||
Assert.notNull(messageSender, "'messageSender' must not be null");
|
||||
messageSenders = new WebServiceMessageSender[]{messageSender};
|
||||
messageSenders = new WebServiceMessageSender[] { messageSender };
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message senders used for sending messages.
|
||||
*
|
||||
* <p>These message senders will be used to resolve an URI to a {@link WebServiceConnection}.
|
||||
* <p>
|
||||
* These message senders will be used to resolve an URI to a {@link WebServiceConnection}.
|
||||
*
|
||||
* @see #createConnection(URI)
|
||||
*/
|
||||
@@ -90,15 +90,15 @@ public abstract class WebServiceAccessor extends TransformerObjectSupport implem
|
||||
|
||||
/**
|
||||
* Creates a connection to the given URI, or throws an exception when it cannot be resolved.
|
||||
*
|
||||
* <p>Default implementation iterates over all configured {@link WebServiceMessageSender} objects, and calls {@link
|
||||
* WebServiceMessageSender#supports(URI)} for each of them. If the sender supports the parameter URI, it creates a
|
||||
* connection using {@link WebServiceMessageSender#createConnection(URI)} .
|
||||
* <p>
|
||||
* Default implementation iterates over all configured {@link WebServiceMessageSender} objects, and calls
|
||||
* {@link WebServiceMessageSender#supports(URI)} for each of them. If the sender supports the parameter URI, it
|
||||
* creates a connection using {@link WebServiceMessageSender#createConnection(URI)} .
|
||||
*
|
||||
* @param uri the URI to open a connection to
|
||||
* @return the created connection
|
||||
* @throws IllegalArgumentException when the uri cannot be resolved
|
||||
* @throws IOException when an I/O error occurs
|
||||
* @throws IOException when an I/O error occurs
|
||||
*/
|
||||
protected WebServiceConnection createConnection(URI uri) throws IOException {
|
||||
Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required");
|
||||
@@ -109,8 +109,7 @@ public abstract class WebServiceAccessor extends TransformerObjectSupport implem
|
||||
if (logger.isDebugEnabled()) {
|
||||
try {
|
||||
logger.debug("Opening [" + connection + "] to [" + connection.getUri() + "]");
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
} catch (URISyntaxException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link DestinationProvider} implementations that cache destination URI.
|
||||
*
|
||||
* <p>Caching can be disabled by setting the {@link #setCache(boolean) cache} property to {@code false}; forcing a
|
||||
* <p>
|
||||
* Caching can be disabled by setting the {@link #setCache(boolean) cache} property to {@code false}; forcing a
|
||||
* destination lookup for every call.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -40,9 +40,9 @@ public abstract class AbstractCachingDestinationProvider implements DestinationP
|
||||
private boolean cache = true;
|
||||
|
||||
/**
|
||||
* Set whether to cache resolved destinations. Default is {@code true}. This flag can be turned off to
|
||||
* re-lookup a destination for each operation, which allows for hot restarting of destinations. This is mainly
|
||||
* useful during development.
|
||||
* Set whether to cache resolved destinations. Default is {@code true}. This flag can be turned off to re-lookup a
|
||||
* destination for each operation, which allows for hot restarting of destinations. This is mainly useful during
|
||||
* development.
|
||||
*/
|
||||
public void setCache(boolean cache) {
|
||||
this.cache = cache;
|
||||
@@ -55,16 +55,15 @@ public abstract class AbstractCachingDestinationProvider implements DestinationP
|
||||
cachedUri = lookupDestination();
|
||||
}
|
||||
return cachedUri;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return lookupDestination();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract template method that looks up the URI.
|
||||
*
|
||||
* <p>If {@linkplain #setCache(boolean) caching} is enabled, this method will only be called once.
|
||||
* <p>
|
||||
* If {@linkplain #setCache(boolean) caching} is enabled, this method will only be called once.
|
||||
*
|
||||
* @return the destination URI
|
||||
*/
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.net.URI;
|
||||
/**
|
||||
* Strategy interface for providing a {@link org.springframework.ws.client.core.WebServiceTemplate} destination URI at
|
||||
* runtime.
|
||||
*
|
||||
* <p>Typically implemented by providers that use WSDL, a UDDI registry, or some other form to determine the destination
|
||||
* <p>
|
||||
* Typically implemented by providers that use WSDL, a UDDI registry, or some other form to determine the destination
|
||||
* URI.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
|
||||
@@ -20,13 +20,12 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.client.WebServiceIOException;
|
||||
@@ -35,13 +34,14 @@ import org.springframework.xml.transform.ResourceSource;
|
||||
import org.springframework.xml.transform.TransformerFactoryUtils;
|
||||
import org.springframework.xml.xpath.XPathExpression;
|
||||
import org.springframework.xml.xpath.XPathExpressionFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link DestinationProvider} that resolves a destination URI from a WSDL file.
|
||||
*
|
||||
* <p>The extraction relies on an XPath expression to locate the URI. By default, the {@link
|
||||
* #DEFAULT_WSDL_LOCATION_EXPRESSION} will be used, but this expression can be overridden by setting the {@link
|
||||
* #setLocationExpression(String) locationExpression} property.
|
||||
* <p>
|
||||
* The extraction relies on an XPath expression to locate the URI. By default, the
|
||||
* {@link #DEFAULT_WSDL_LOCATION_EXPRESSION} will be used, but this expression can be overridden by setting the
|
||||
* {@link #setLocationExpression(String) locationExpression} property.
|
||||
*
|
||||
* @author Tareq Abed Rabbo
|
||||
* @author Arjen Poutsma
|
||||
@@ -50,8 +50,7 @@ import org.springframework.xml.xpath.XPathExpressionFactory;
|
||||
public class Wsdl11DestinationProvider extends AbstractCachingDestinationProvider {
|
||||
|
||||
/** Default XPath expression used for extracting all {@code location} attributes from the WSDL definition. */
|
||||
public static final String DEFAULT_WSDL_LOCATION_EXPRESSION =
|
||||
"/wsdl:definitions/wsdl:service/wsdl:port/soap:address/@location";
|
||||
public static final String DEFAULT_WSDL_LOCATION_EXPRESSION = "/wsdl:definitions/wsdl:service/wsdl:port/soap:address/@location";
|
||||
|
||||
private static TransformerFactory transformerFactory = TransformerFactoryUtils.newInstance();
|
||||
|
||||
@@ -66,8 +65,8 @@ public class Wsdl11DestinationProvider extends AbstractCachingDestinationProvide
|
||||
expressionNamespaces.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
|
||||
expressionNamespaces.put("soap12", "http://schemas.xmlsoap.org/wsdl/soap12/");
|
||||
|
||||
locationXPathExpression = XPathExpressionFactory
|
||||
.createXPathExpression(DEFAULT_WSDL_LOCATION_EXPRESSION, expressionNamespaces);
|
||||
locationXPathExpression = XPathExpressionFactory.createXPathExpression(DEFAULT_WSDL_LOCATION_EXPRESSION,
|
||||
expressionNamespaces);
|
||||
}
|
||||
|
||||
/** Sets a WSDL location from which the service destination {@code URI} will be resolved. */
|
||||
@@ -79,19 +78,33 @@ public class Wsdl11DestinationProvider extends AbstractCachingDestinationProvide
|
||||
|
||||
/**
|
||||
* Sets the XPath expression to use when extracting the service location {@code URI} from a WSDL.
|
||||
*
|
||||
* <p>The expression can use the following bound prefixes: <blockquote> <table> <tr><th>Prefix</th><th>Namespace</th></tr>
|
||||
* <tr><td>{@code wsdl}</td><td>{@code http://schemas.xmlsoap.org/wsdl/}</td></tr>
|
||||
* <tr><td>{@code soap}</td><td>{@code http://schemas.xmlsoap.org/wsdl/soap/}</td></tr>
|
||||
* <tr><td>{@code soap12}</td><td>{@code http://schemas.xmlsoap.org/wsdl/soap12/}</td></tr>
|
||||
* </table></blockquote>
|
||||
*
|
||||
* <p>Defaults to {@link #DEFAULT_WSDL_LOCATION_EXPRESSION}.
|
||||
* <p>
|
||||
* The expression can use the following bound prefixes: <blockquote>
|
||||
* <table>
|
||||
* <tr>
|
||||
* <th>Prefix</th>
|
||||
* <th>Namespace</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@code wsdl}</td>
|
||||
* <td>{@code http://schemas.xmlsoap.org/wsdl/}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@code soap}</td>
|
||||
* <td>{@code http://schemas.xmlsoap.org/wsdl/soap/}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@code soap12}</td>
|
||||
* <td>{@code http://schemas.xmlsoap.org/wsdl/soap12/}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
* <p>
|
||||
* Defaults to {@link #DEFAULT_WSDL_LOCATION_EXPRESSION}.
|
||||
*/
|
||||
public void setLocationExpression(String expression) {
|
||||
Assert.hasText(expression, "'expression' must not be empty");
|
||||
locationXPathExpression = XPathExpressionFactory
|
||||
.createXPathExpression(expression, expressionNamespaces);
|
||||
locationXPathExpression = XPathExpressionFactory.createXPathExpression(expression, expressionNamespaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,11 +119,9 @@ public class Wsdl11DestinationProvider extends AbstractCachingDestinationProvide
|
||||
logger.debug("Found location [" + location + "] in " + wsdlResource);
|
||||
}
|
||||
return location != null ? URI.create(location) : null;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
throw new WebServiceIOException("Error extracting location from WSDL [" + wsdlResource + "]", ex);
|
||||
}
|
||||
catch (TransformerException ex) {
|
||||
} catch (TransformerException ex) {
|
||||
throw new WebServiceTransformerException("Error extracting location from WSDL [" + wsdlResource + "]", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
package org.springframework.ws.client.support.interceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -35,13 +34,14 @@ import org.springframework.xml.validation.XmlValidator;
|
||||
import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
import org.springframework.xml.xsd.XsdSchema;
|
||||
import org.springframework.xml.xsd.XsdSchemaCollection;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link ClientInterceptor} implementations that validate part of the message using a schema.
|
||||
* The exact message part is determined by the {@link #getValidationRequestSource(WebServiceMessage)} and {@link
|
||||
* #getValidationResponseSource(WebServiceMessage)} template methods.
|
||||
*
|
||||
* <p>By default, only the request message is validated, but this behaviour can be changed using the
|
||||
* The exact message part is determined by the {@link #getValidationRequestSource(WebServiceMessage)} and
|
||||
* {@link #getValidationResponseSource(WebServiceMessage)} template methods.
|
||||
* <p>
|
||||
* By default, only the request message is validated, but this behaviour can be changed using the
|
||||
* {@code validateRequest} and {@code validateResponse} properties.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -82,18 +82,18 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the schema resource to use for validation. Setting this property, {@link
|
||||
* #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or {@link
|
||||
* #setSchemas(Resource[]) schemas} is required.
|
||||
* Sets the schema resource to use for validation. Setting this property,
|
||||
* {@link #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or
|
||||
* {@link #setSchemas(Resource[]) schemas} is required.
|
||||
*/
|
||||
public void setSchema(Resource schema) {
|
||||
setSchemas(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the schema resources to use for validation. Setting this property, {@link
|
||||
* #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or {@link
|
||||
* #setSchemas(Resource[]) schemas} is required.
|
||||
* Sets the schema resources to use for validation. Setting this property,
|
||||
* {@link #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or
|
||||
* {@link #setSchemas(Resource[]) schemas} is required.
|
||||
*/
|
||||
public void setSchemas(Resource... schemas) {
|
||||
Assert.notEmpty(schemas, "schemas must not be empty or null");
|
||||
@@ -105,9 +105,9 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link XsdSchema} to use for validation. Setting this property, {@link
|
||||
* #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or {@link
|
||||
* #setSchemas(Resource[]) schemas} is required.
|
||||
* Sets the {@link XsdSchema} to use for validation. Setting this property,
|
||||
* {@link #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or
|
||||
* {@link #setSchemas(Resource[]) schemas} is required.
|
||||
*
|
||||
* @param schema the xsd schema to use
|
||||
* @throws java.io.IOException in case of I/O errors
|
||||
@@ -117,9 +117,8 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link XsdSchemaCollection} to use for validation. Setting this property, {@link
|
||||
* #setXsdSchema(XsdSchema) xsdSchema}, {@link #setSchema(Resource) schema}, or {@link #setSchemas(Resource[])
|
||||
* schemas} is required.
|
||||
* Sets the {@link XsdSchemaCollection} to use for validation. Setting this property, {@link #setXsdSchema(XsdSchema)
|
||||
* xsdSchema}, {@link #setSchema(Resource) schema}, or {@link #setSchemas(Resource[]) schemas} is required.
|
||||
*
|
||||
* @param schemaCollection the xsd schema collection to use
|
||||
* @throws java.io.IOException in case of I/O errors
|
||||
@@ -154,10 +153,10 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the request message in the given message context. Validation only occurs if {@link
|
||||
* #setValidateRequest(boolean) validateRequest} is set to {@code true}, which is the default.
|
||||
*
|
||||
* <p>Returns {@code true} if the request is valid, or {@code false} if it isn't.
|
||||
* Validates the request message in the given message context. Validation only occurs if
|
||||
* {@link #setValidateRequest(boolean) validateRequest} is set to {@code true}, which is the default.
|
||||
* <p>
|
||||
* Returns {@code true} if the request is valid, or {@code false} if it isn't.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @return {@code true} if the message is valid; {@code false} otherwise
|
||||
@@ -171,14 +170,12 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
SAXParseException[] errors;
|
||||
try {
|
||||
errors = validator.validate(requestSource);
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
throw new WebServiceIOException("Could not validate response: " + e.getMessage(), e);
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(errors)) {
|
||||
return handleRequestValidationErrors(messageContext, errors);
|
||||
}
|
||||
else if (logger.isDebugEnabled()) {
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Request message validated");
|
||||
}
|
||||
}
|
||||
@@ -188,12 +185,12 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
|
||||
/**
|
||||
* Template method that is called when the request message contains validation errors.
|
||||
*
|
||||
* <p>Default implementation logs all errors, and throws a {@link WebServiceValidationException}. Subclasses can
|
||||
* override this method to customize this behavior.
|
||||
* <p>
|
||||
* Default implementation logs all errors, and throws a {@link WebServiceValidationException}. Subclasses can override
|
||||
* this method to customize this behavior.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param errors the validation errors
|
||||
* @param errors the validation errors
|
||||
* @return {@code true} to continue processing the request, {@code false} otherwise
|
||||
*/
|
||||
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors) {
|
||||
@@ -204,11 +201,11 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the response message in the given message context. Validation only occurs if {@link
|
||||
* #setValidateResponse(boolean) validateResponse} is set to {@code true}, which is <strong>not</strong> the
|
||||
* Validates the response message in the given message context. Validation only occurs if
|
||||
* {@link #setValidateResponse(boolean) validateResponse} is set to {@code true}, which is <strong>not</strong> the
|
||||
* default.
|
||||
*
|
||||
* <p>Returns {@code true} if the request is valid, or {@code false} if it isn't.
|
||||
* <p>
|
||||
* Returns {@code true} if the request is valid, or {@code false} if it isn't.
|
||||
*
|
||||
* @param messageContext the message context.
|
||||
* @return {@code true} if the response is valid; {@code false} otherwise
|
||||
@@ -222,14 +219,12 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
SAXParseException[] errors;
|
||||
try {
|
||||
errors = validator.validate(responseSource);
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
throw new WebServiceIOException("Could not validate response: " + e.getMessage(), e);
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(errors)) {
|
||||
return handleResponseValidationErrors(messageContext, errors);
|
||||
}
|
||||
else if (logger.isDebugEnabled()) {
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Response message validated");
|
||||
}
|
||||
}
|
||||
@@ -239,12 +234,12 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
|
||||
/**
|
||||
* Template method that is called when the response message contains validation errors.
|
||||
*
|
||||
* <p>Default implementation logs all errors, and returns {@code false}, i.e. do not cot continue to process the
|
||||
* respone interceptor chain.
|
||||
* <p>
|
||||
* Default implementation logs all errors, and returns {@code false}, i.e. do not cot continue to process the respone
|
||||
* interceptor chain.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param errors the validation errors
|
||||
* @param errors the validation errors
|
||||
* @return {@code true} to continue the reponse interceptor chain, {@code false} (the default) otherwise
|
||||
*/
|
||||
protected boolean handleResponseValidationErrors(MessageContext messageContext, SAXParseException[] errors)
|
||||
@@ -261,11 +256,9 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Does nothing by default.*/
|
||||
/** Does nothing by default. */
|
||||
@Override
|
||||
public void afterCompletion(MessageContext messageContext, Exception ex)
|
||||
throws WebServiceClientException {
|
||||
}
|
||||
public void afterCompletion(MessageContext messageContext, Exception ex) throws WebServiceClientException {}
|
||||
|
||||
/**
|
||||
* Abstract template method that returns the part of the request message that is to be validated.
|
||||
|
||||
@@ -25,16 +25,17 @@ import org.springframework.ws.transport.WebServiceConnection;
|
||||
* Workflow interface that allows for customized client-side message interception. Applications can register any number
|
||||
* of existing or custom interceptors on a {@link org.springframework.ws.client.core.WebServiceTemplate}, to add common
|
||||
* pre- and postprocessing behavior without needing to modify payload handling code.
|
||||
*
|
||||
* <p>A {@code ClientInterceptor} gets called after payload creation (using {@link
|
||||
* org.springframework.ws.client.core.WebServiceTemplate#marshalSendAndReceive(Object)} or similar methods, and after
|
||||
* {@link org.springframework.ws.client.core.WebServiceMessageCallback callback} invocation, but before the message is
|
||||
* sent over the {@link WebServiceConnection}. This mechanism can be used for a large field of preprocessing aspects,
|
||||
* e.g. for authorization checks, or message header checks. Its main purpose is to allow for factoring out meta-data
|
||||
* (i.e. {@link SoapHeader}) related code.
|
||||
*
|
||||
* <p>Client interceptors are defined on a {@link org.springframework.ws.client.core.WebServiceTemplate}, using the {@link
|
||||
* org.springframework.ws.client.core.WebServiceTemplate#setInterceptors(ClientInterceptor[]) interceptors} property.
|
||||
* <p>
|
||||
* A {@code ClientInterceptor} gets called after payload creation (using
|
||||
* {@link org.springframework.ws.client.core.WebServiceTemplate#marshalSendAndReceive(Object)} or similar methods, and
|
||||
* after {@link org.springframework.ws.client.core.WebServiceMessageCallback callback} invocation, but before the
|
||||
* message is sent over the {@link WebServiceConnection}. This mechanism can be used for a large field of preprocessing
|
||||
* aspects, e.g. for authorization checks, or message header checks. Its main purpose is to allow for factoring out
|
||||
* meta-data (i.e. {@link SoapHeader}) related code.
|
||||
* <p>
|
||||
* Client interceptors are defined on a {@link org.springframework.ws.client.core.WebServiceTemplate}, using the
|
||||
* {@link org.springframework.ws.client.core.WebServiceTemplate#setInterceptors(ClientInterceptor[]) interceptors}
|
||||
* property.
|
||||
*
|
||||
* @author Giovanni Cuccu
|
||||
* @author Arjen Poutsma
|
||||
@@ -48,8 +49,8 @@ public interface ClientInterceptor {
|
||||
* message is sent.
|
||||
*
|
||||
* @param messageContext contains the outgoing request message
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate
|
||||
* blocking of the request endpoint chain
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate blocking of the
|
||||
* request endpoint chain
|
||||
* @throws WebServiceClientException in case of errors
|
||||
* @see MessageContext#getRequest()
|
||||
*/
|
||||
@@ -58,26 +59,26 @@ public interface ClientInterceptor {
|
||||
/**
|
||||
* Processes the incoming response message. Called for non-fault response messages before payload handling in the
|
||||
* {@link org.springframework.ws.client.core.WebServiceTemplate}.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* @param messageContext contains the outgoing request message
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate
|
||||
* blocking of the response endpoint chain
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate blocking of the
|
||||
* response endpoint chain
|
||||
* @throws WebServiceClientException in case of errors
|
||||
* @see MessageContext#getResponse()
|
||||
*/
|
||||
boolean handleResponse(MessageContext messageContext) throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Processes the incoming response fault. Called for response fault messages before payload handling in the {@link
|
||||
* org.springframework.ws.client.core.WebServiceTemplate}.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* Processes the incoming response fault. Called for response fault messages before payload handling in the
|
||||
* {@link org.springframework.ws.client.core.WebServiceTemplate}.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* @param messageContext contains the outgoing request message
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate
|
||||
* blocking of the request endpoint chain
|
||||
* @return {@code true} to continue processing of the request interceptors; {@code false} to indicate blocking of the
|
||||
* request endpoint chain
|
||||
* @throws WebServiceClientException in case of errors
|
||||
* @see MessageContext#getResponse()
|
||||
* @see org.springframework.ws.FaultAwareWebServiceMessage#hasFault()
|
||||
@@ -85,10 +86,10 @@ public interface ClientInterceptor {
|
||||
boolean handleFault(MessageContext messageContext) throws WebServiceClientException;
|
||||
|
||||
/**
|
||||
* Callback after completion of request and response (fault) processing. Will be called on any outcome, thus
|
||||
* allows for proper resource cleanup.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* Callback after completion of request and response (fault) processing. Will be called on any outcome, thus allows
|
||||
* for proper resource cleanup.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* @param messageContext contains both request and response messages, the response should contains a Fault
|
||||
* @param ex exception thrown on handler execution, if any
|
||||
@@ -97,5 +98,4 @@ public interface ClientInterceptor {
|
||||
*/
|
||||
void afterCompletion(MessageContext messageContext, Exception ex) throws WebServiceClientException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.ws.client.support.interceptor;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.ws.client.WebServiceClientException;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
|
||||
@@ -21,15 +21,14 @@ import javax.xml.transform.Source;
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
|
||||
/**
|
||||
* Client-side interceptor that validates the contents of {@code WebServiceMessage}s using a schema. Allows for
|
||||
* both W3C XML and RELAX NG schemas.
|
||||
*
|
||||
* <p>When the payload is invalid, this interceptor stops processing of the interceptor chain.
|
||||
*
|
||||
* <p>The schema to validate against is set with the {@code schema} property or {@code schemas} property. By
|
||||
* default, only the request message is validated, but this behaviour can be changed using the
|
||||
* {@code validateRequest} and {@code validateResponse} properties. Responses that contains faults are not
|
||||
* validated.
|
||||
* Client-side interceptor that validates the contents of {@code WebServiceMessage}s using a schema. Allows for both W3C
|
||||
* XML and RELAX NG schemas.
|
||||
* <p>
|
||||
* When the payload is invalid, this interceptor stops processing of the interceptor chain.
|
||||
* <p>
|
||||
* The schema to validate against is set with the {@code schema} property or {@code schemas} property. By default, only
|
||||
* the request message is validated, but this behaviour can be changed using the {@code validateRequest} and
|
||||
* {@code validateResponse} properties. Responses that contains faults are not validated.
|
||||
*
|
||||
* @author Stefan Schmidt
|
||||
* @author Arjen Poutsma
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.ws.client.support.interceptor;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import org.springframework.ws.client.WebServiceClientException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Exception thrown whenever a validation error occurs on the client-side.
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.ws.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
@@ -48,6 +46,7 @@ import org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionR
|
||||
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapHeaderElementMethodArgumentResolver;
|
||||
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
|
||||
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* {@link BeanDefinitionParser} that parses the {@code annotation-driven} element to configure a Spring WS application.
|
||||
@@ -57,20 +56,20 @@ import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationM
|
||||
*/
|
||||
class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
private static final boolean dom4jPresent =
|
||||
ClassUtils.isPresent("org.dom4j.Element", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean dom4jPresent = ClassUtils.isPresent("org.dom4j.Element",
|
||||
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final boolean jaxb2Present =
|
||||
ClassUtils.isPresent("javax.xml.bind.Binder", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean jaxb2Present = ClassUtils.isPresent("javax.xml.bind.Binder",
|
||||
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final boolean jdomPresent =
|
||||
ClassUtils.isPresent("org.jdom2.Element", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean jdomPresent = ClassUtils.isPresent("org.jdom2.Element",
|
||||
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final boolean staxPresent = ClassUtils
|
||||
.isPresent("javax.xml.stream.XMLInputFactory", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean staxPresent = ClassUtils.isPresent("javax.xml.stream.XMLInputFactory",
|
||||
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final boolean xomPresent =
|
||||
ClassUtils.isPresent("nu.xom.Element", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean xomPresent = ClassUtils.isPresent("nu.xom.Element",
|
||||
AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
@@ -91,18 +90,17 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private void registerEndpointMappings(Object source, ParserContext parserContext) {
|
||||
RootBeanDefinition payloadRootMappingDef =
|
||||
createBeanDefinition(PayloadRootAnnotationMethodEndpointMapping.class, source);
|
||||
RootBeanDefinition payloadRootMappingDef = createBeanDefinition(PayloadRootAnnotationMethodEndpointMapping.class,
|
||||
source);
|
||||
payloadRootMappingDef.getPropertyValues().add("order", 0);
|
||||
parserContext.getReaderContext().registerWithGeneratedName(payloadRootMappingDef);
|
||||
|
||||
RootBeanDefinition soapActionMappingDef =
|
||||
createBeanDefinition(SoapActionAnnotationMethodEndpointMapping.class, source);
|
||||
RootBeanDefinition soapActionMappingDef = createBeanDefinition(SoapActionAnnotationMethodEndpointMapping.class,
|
||||
source);
|
||||
soapActionMappingDef.getPropertyValues().add("order", 1);
|
||||
parserContext.getReaderContext().registerWithGeneratedName(soapActionMappingDef);
|
||||
|
||||
RootBeanDefinition annActionMappingDef =
|
||||
createBeanDefinition(AnnotationActionEndpointMapping.class, source);
|
||||
RootBeanDefinition annActionMappingDef = createBeanDefinition(AnnotationActionEndpointMapping.class, source);
|
||||
annActionMappingDef.getPropertyValues().add("order", 2);
|
||||
parserContext.getReaderContext().registerWithGeneratedName(annActionMappingDef);
|
||||
}
|
||||
@@ -125,31 +123,30 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
argumentResolvers.add(domProcessor);
|
||||
returnValueHandlers.add(domProcessor);
|
||||
|
||||
RuntimeBeanReference sourceProcessor =
|
||||
createBeanReference(SourcePayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference sourceProcessor = createBeanReference(SourcePayloadMethodProcessor.class, source,
|
||||
parserContext);
|
||||
argumentResolvers.add(sourceProcessor);
|
||||
returnValueHandlers.add(sourceProcessor);
|
||||
|
||||
if (dom4jPresent) {
|
||||
RuntimeBeanReference dom4jProcessor =
|
||||
createBeanReference(Dom4jPayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference dom4jProcessor = createBeanReference(Dom4jPayloadMethodProcessor.class, source,
|
||||
parserContext);
|
||||
argumentResolvers.add(dom4jProcessor);
|
||||
returnValueHandlers.add(dom4jProcessor);
|
||||
}
|
||||
if (jaxb2Present) {
|
||||
RuntimeBeanReference xmlRootElementProcessor =
|
||||
createBeanReference(XmlRootElementPayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference xmlRootElementProcessor = createBeanReference(XmlRootElementPayloadMethodProcessor.class,
|
||||
source, parserContext);
|
||||
argumentResolvers.add(xmlRootElementProcessor);
|
||||
returnValueHandlers.add(xmlRootElementProcessor);
|
||||
|
||||
RuntimeBeanReference jaxbElementProcessor =
|
||||
createBeanReference(JaxbElementPayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference jaxbElementProcessor = createBeanReference(JaxbElementPayloadMethodProcessor.class, source,
|
||||
parserContext);
|
||||
argumentResolvers.add(jaxbElementProcessor);
|
||||
returnValueHandlers.add(jaxbElementProcessor);
|
||||
}
|
||||
if (jdomPresent) {
|
||||
RuntimeBeanReference jdomProcessor =
|
||||
createBeanReference(JDomPayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference jdomProcessor = createBeanReference(JDomPayloadMethodProcessor.class, source, parserContext);
|
||||
argumentResolvers.add(jdomProcessor);
|
||||
returnValueHandlers.add(jdomProcessor);
|
||||
}
|
||||
@@ -157,8 +154,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
argumentResolvers.add(createBeanDefinition(StaxPayloadMethodArgumentResolver.class, source));
|
||||
}
|
||||
if (xomPresent) {
|
||||
RuntimeBeanReference xomProcessor =
|
||||
createBeanReference(XomPayloadMethodProcessor.class, source, parserContext);
|
||||
RuntimeBeanReference xomProcessor = createBeanReference(XomPayloadMethodProcessor.class, source, parserContext);
|
||||
argumentResolvers.add(xomProcessor);
|
||||
returnValueHandlers.add(xomProcessor);
|
||||
}
|
||||
@@ -167,13 +163,12 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
RuntimeBeanReference unmarshallerReference;
|
||||
if (element.hasAttribute("unmarshaller")) {
|
||||
unmarshallerReference = new RuntimeBeanReference(element.getAttribute("unmarshaller"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
unmarshallerReference = marshallerReference;
|
||||
}
|
||||
|
||||
RootBeanDefinition marshallingProcessorDef =
|
||||
createBeanDefinition(MarshallingPayloadMethodProcessor.class, source);
|
||||
RootBeanDefinition marshallingProcessorDef = createBeanDefinition(MarshallingPayloadMethodProcessor.class,
|
||||
source);
|
||||
marshallingProcessorDef.getPropertyValues().add("marshaller", marshallerReference);
|
||||
marshallingProcessorDef.getPropertyValues().add("unmarshaller", unmarshallerReference);
|
||||
argumentResolvers.add(marshallingProcessorDef);
|
||||
@@ -187,13 +182,11 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private void registerEndpointExceptionResolvers(Object source, ParserContext parserContext) {
|
||||
RootBeanDefinition annotationResolverDef =
|
||||
createBeanDefinition(SoapFaultAnnotationExceptionResolver.class, source);
|
||||
RootBeanDefinition annotationResolverDef = createBeanDefinition(SoapFaultAnnotationExceptionResolver.class, source);
|
||||
annotationResolverDef.getPropertyValues().add("order", 0);
|
||||
parserContext.getReaderContext().registerWithGeneratedName(annotationResolverDef);
|
||||
|
||||
RootBeanDefinition simpleResolverDef =
|
||||
createBeanDefinition(SimpleSoapExceptionResolver.class, source);
|
||||
RootBeanDefinition simpleResolverDef = createBeanDefinition(SimpleSoapExceptionResolver.class, source);
|
||||
simpleResolverDef.getPropertyValues().add("order", Ordered.LOWEST_PRECEDENCE);
|
||||
parserContext.getReaderContext().registerWithGeneratedName(simpleResolverDef);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.util.xml.DomUtils;
|
||||
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
|
||||
import org.springframework.xml.xsd.SimpleXsdSchema;
|
||||
import org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -76,12 +75,10 @@ class DynamicWsdlBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||
collectionDef.getPropertyValues().addPropertyValue("xsds", xsds);
|
||||
String collectionName = parserContext.getReaderContext().registerWithGeneratedName(collectionDef);
|
||||
wsdlBuilder.addPropertyReference("schemaCollection", collectionName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (schemas.size() > 1) {
|
||||
throw new IllegalArgumentException(
|
||||
"Multiple <xsd/> elements requires Commons XMLSchema." +
|
||||
"Please put Commons XMLSchema on the classpath.");
|
||||
"Multiple <xsd/> elements requires Commons XMLSchema." + "Please put Commons XMLSchema on the classpath.");
|
||||
}
|
||||
RootBeanDefinition schemaDef = createBeanDefinition(SimpleXsdSchema.class, source);
|
||||
Element schema = schemas.iterator().next();
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.springframework.ws.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.BeanReference;
|
||||
@@ -35,6 +33,7 @@ import org.springframework.ws.server.SmartEndpointInterceptor;
|
||||
import org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor;
|
||||
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadRootSmartSoapEndpointInterceptor;
|
||||
import org.springframework.ws.soap.server.endpoint.interceptor.SoapActionSmartEndpointInterceptor;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the {@code <sws:interceptors/>} element.
|
||||
@@ -46,26 +45,23 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
CompositeComponentDefinition compDefinition =
|
||||
new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
|
||||
CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(),
|
||||
parserContext.extractSource(element));
|
||||
parserContext.pushContainingComponent(compDefinition);
|
||||
|
||||
List<Element> childElements = DomUtils.getChildElements(element);
|
||||
for (Element childElement : childElements) {
|
||||
if ("bean".equals(childElement.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(DelegatingSmartSoapEndpointInterceptor.class, childElement,
|
||||
parserContext);
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
DelegatingSmartSoapEndpointInterceptor.class, childElement, parserContext);
|
||||
BeanDefinitionHolder interceptorDef = createInterceptorDefinition(parserContext, childElement);
|
||||
|
||||
smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorDef);
|
||||
|
||||
registerSmartInterceptor(parserContext, smartInterceptorDef);
|
||||
}
|
||||
else if ("ref".equals(childElement.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(DelegatingSmartSoapEndpointInterceptor.class, childElement,
|
||||
parserContext);
|
||||
} else if ("ref".equals(childElement.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
DelegatingSmartSoapEndpointInterceptor.class, childElement, parserContext);
|
||||
|
||||
BeanReference interceptorRef = createInterceptorReference(parserContext, childElement);
|
||||
|
||||
@@ -73,16 +69,13 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
registerSmartInterceptor(parserContext, smartInterceptorDef);
|
||||
|
||||
}
|
||||
else if ("payloadRoot".equals(childElement.getLocalName())) {
|
||||
} else if ("payloadRoot".equals(childElement.getLocalName())) {
|
||||
List<Element> payloadRootChildren = DomUtils.getChildElements(childElement);
|
||||
for (Element payloadRootChild : payloadRootChildren) {
|
||||
if ("bean".equals(payloadRootChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(PayloadRootSmartSoapEndpointInterceptor.class,
|
||||
childElement, parserContext);
|
||||
BeanDefinitionHolder interceptorDef =
|
||||
createInterceptorDefinition(parserContext, payloadRootChild);
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
PayloadRootSmartSoapEndpointInterceptor.class, childElement, parserContext);
|
||||
BeanDefinitionHolder interceptorDef = createInterceptorDefinition(parserContext, payloadRootChild);
|
||||
|
||||
String namespaceUri = childElement.getAttribute("namespaceUri");
|
||||
String localPart = childElement.getAttribute("localPart");
|
||||
@@ -92,11 +85,9 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(2, localPart);
|
||||
|
||||
registerSmartInterceptor(parserContext, smartInterceptorDef);
|
||||
}
|
||||
else if ("ref".equals(payloadRootChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(PayloadRootSmartSoapEndpointInterceptor.class,
|
||||
childElement, parserContext);
|
||||
} else if ("ref".equals(payloadRootChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
PayloadRootSmartSoapEndpointInterceptor.class, childElement, parserContext);
|
||||
BeanReference interceptorRef = createInterceptorReference(parserContext, payloadRootChild);
|
||||
|
||||
String namespaceUri = childElement.getAttribute("namespaceUri");
|
||||
@@ -109,16 +100,13 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
registerSmartInterceptor(parserContext, smartInterceptorDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("soapAction".equals(childElement.getLocalName())) {
|
||||
} else if ("soapAction".equals(childElement.getLocalName())) {
|
||||
List<Element> soapActionChildren = DomUtils.getChildElements(childElement);
|
||||
for (Element soapActionChild : soapActionChildren) {
|
||||
if ("bean".equals(soapActionChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(SoapActionSmartEndpointInterceptor.class, childElement,
|
||||
parserContext);
|
||||
BeanDefinitionHolder interceptorDef =
|
||||
createInterceptorDefinition(parserContext, soapActionChild);
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
SoapActionSmartEndpointInterceptor.class, childElement, parserContext);
|
||||
BeanDefinitionHolder interceptorDef = createInterceptorDefinition(parserContext, soapActionChild);
|
||||
|
||||
String soapAction = childElement.getAttribute("value");
|
||||
|
||||
@@ -126,11 +114,9 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(1, soapAction);
|
||||
|
||||
registerSmartInterceptor(parserContext, smartInterceptorDef);
|
||||
}
|
||||
else if ("ref".equals(soapActionChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef =
|
||||
createSmartInterceptorDefinition(SoapActionSmartEndpointInterceptor.class, childElement,
|
||||
parserContext);
|
||||
} else if ("ref".equals(soapActionChild.getLocalName())) {
|
||||
RootBeanDefinition smartInterceptorDef = createSmartInterceptorDefinition(
|
||||
SoapActionSmartEndpointInterceptor.class, childElement, parserContext);
|
||||
BeanReference interceptorRef = createInterceptorReference(parserContext, soapActionChild);
|
||||
|
||||
String soapAction = childElement.getAttribute("value");
|
||||
@@ -179,9 +165,8 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return ref;
|
||||
}
|
||||
|
||||
private RootBeanDefinition createSmartInterceptorDefinition(Class<? extends SmartEndpointInterceptor> interceptorClass,
|
||||
Element element,
|
||||
ParserContext parserContext) {
|
||||
private RootBeanDefinition createSmartInterceptorDefinition(
|
||||
Class<? extends SmartEndpointInterceptor> interceptorClass, Element element, ParserContext parserContext) {
|
||||
RootBeanDefinition smartInterceptorDef = new RootBeanDefinition(interceptorClass);
|
||||
smartInterceptorDef.setSource(parserContext.extractSource(element));
|
||||
smartInterceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -34,15 +33,13 @@ import org.w3c.dom.Element;
|
||||
@Deprecated
|
||||
class MarshallingEndpointsBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
private static final String GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME =
|
||||
"org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter";
|
||||
private static final String GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME = "org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter";
|
||||
|
||||
private static final boolean genericAdapterPresent =
|
||||
ClassUtils.isPresent(GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME,
|
||||
MarshallingEndpointsBeanDefinitionParser.class.getClassLoader());
|
||||
private static final boolean genericAdapterPresent = ClassUtils.isPresent(
|
||||
GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME,
|
||||
MarshallingEndpointsBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final String MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME =
|
||||
"org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter";
|
||||
private static final String MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME = "org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter";
|
||||
|
||||
@Override
|
||||
protected boolean shouldGenerateIdAsFallback() {
|
||||
@@ -52,7 +49,7 @@ class MarshallingEndpointsBeanDefinitionParser extends AbstractSimpleBeanDefinit
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
if (genericAdapterPresent) {
|
||||
return GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME;
|
||||
return GENERIC_MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME;
|
||||
}
|
||||
return MARSHALLING_METHOD_ENDPOINT_ADAPTER_CLASS_NAME;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -36,8 +35,7 @@ import org.w3c.dom.Element;
|
||||
@Deprecated
|
||||
class XPathEndpointsBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
private static final String XPATH_PARAM_ANNOTATION_METHOD_ENDPOINT_ADAPTER_CLASS_NAME =
|
||||
"org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter";
|
||||
private static final String XPATH_PARAM_ANNOTATION_METHOD_ENDPOINT_ADAPTER_CLASS_NAME = "org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter";
|
||||
|
||||
@Override
|
||||
protected boolean shouldGenerateIdAsFallback() {
|
||||
|
||||
@@ -9,10 +9,9 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResol
|
||||
import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler;
|
||||
|
||||
/**
|
||||
* A sub-class of {@code WsConfigurationSupport} that detects and delegates
|
||||
* to all beans of type {@link WsConfigurer} allowing them to customize the
|
||||
* configuration provided by {@code WsConfigurationSupport}. This is the
|
||||
* class actually imported by {@link EnableWs @EnableWs}.
|
||||
* A sub-class of {@code WsConfigurationSupport} that detects and delegates to all beans of type {@link WsConfigurer}
|
||||
* allowing them to customize the configuration provided by {@code WsConfigurationSupport}. This is the class actually
|
||||
* imported by {@link EnableWs @EnableWs}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.2
|
||||
@@ -40,8 +39,7 @@ public class DelegatingWsConfiguration extends WsConfigurationSupport {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addReturnValueHandlers(
|
||||
List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
protected void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
this.configurers.addReturnValueHandlers(returnValueHandlers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Add this annotation to an {@link Configuration @Configuration} class to have the Spring
|
||||
* Web Services configuration defined in {@link WsConfigurationSupport} imported. For
|
||||
* instance:
|
||||
* Add this annotation to an {@link Configuration @Configuration} class to have the Spring Web Services configuration
|
||||
* defined in {@link WsConfigurationSupport} imported. For instance:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
@@ -38,9 +37,9 @@ import org.springframework.context.annotation.Import;
|
||||
*
|
||||
* }
|
||||
* </pre>
|
||||
* <p>Customize the imported configuration by implementing the
|
||||
* {@link WsConfigurer} interface or more likely by extending the
|
||||
* {@link WsConfigurerAdapter} base class and overriding individual methods:
|
||||
* <p>
|
||||
* Customize the imported configuration by implementing the {@link WsConfigurer} interface or more likely by extending
|
||||
* the {@link WsConfigurerAdapter} base class and overriding individual methods:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
@@ -48,48 +47,46 @@ import org.springframework.context.annotation.Import;
|
||||
* @ComponentScan(basePackageClasses = { MyConfiguration.class })
|
||||
* public class MyConfiguration extends WsConfigurerAdapter {
|
||||
*
|
||||
* @Override
|
||||
* public void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
* interceptors.add(new MyInterceptor());
|
||||
* }
|
||||
* @Override
|
||||
* public void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
* interceptors.add(new MyInterceptor());
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
* public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
|
||||
* argumentResolvers.add(new MyArgumentResolver());
|
||||
* }
|
||||
* @Override
|
||||
* public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
|
||||
* argumentResolvers.add(new MyArgumentResolver());
|
||||
* }
|
||||
*
|
||||
* // More overridden methods ...
|
||||
* // More overridden methods ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>If the customization options of {@link WsConfigurer} do not expose
|
||||
* something you need to configure, consider removing the {@code @EnableWs}
|
||||
* annotation and extending directly from {@link WsConfigurationSupport}
|
||||
* overriding selected {@code @Bean} methods:
|
||||
* <p>
|
||||
* If the customization options of {@link WsConfigurer} do not expose something you need to configure, consider removing
|
||||
* the {@code @EnableWs} annotation and extending directly from {@link WsConfigurationSupport} overriding selected
|
||||
* {@code @Bean} methods:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @ComponentScan(basePackageClasses = { MyConfiguration.class })
|
||||
* public class MyConfiguration extends WsConfigurationSupport {
|
||||
*
|
||||
* @Override
|
||||
* public void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
* interceptors.add(new MyInterceptor());
|
||||
* }
|
||||
* @Override
|
||||
* public void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
* interceptors.add(new MyInterceptor());
|
||||
* }
|
||||
*
|
||||
* @Bean
|
||||
* @Override
|
||||
* public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
|
||||
* // Create or delegate to "super" to create and
|
||||
* // customize properties of DefaultMethodEndpointAdapter
|
||||
* }
|
||||
* @Bean
|
||||
* @Override
|
||||
* public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
|
||||
* // Create or delegate to "super" to create and
|
||||
* // customize properties of DefaultMethodEndpointAdapter
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @see WsConfigurer
|
||||
* @see WsConfigurerAdapter
|
||||
* @see WsConfigurationSupport
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.2
|
||||
*/
|
||||
|
||||
@@ -40,44 +40,36 @@ import org.springframework.ws.soap.server.endpoint.annotation.SoapFault;
|
||||
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
|
||||
|
||||
/**
|
||||
* This is the main class providing the configuration behind the Spring Web Services Java
|
||||
* config. It is typically imported by adding {@link EnableWs @EnableWs} to an
|
||||
* application {@link Configuration @Configuration} class. An alternative, more
|
||||
* advanced option is to extend directly from this class and override methods as
|
||||
* necessary remembering to add {@link Configuration @Configuration} to the
|
||||
* subclass and {@link Bean @Bean} to overridden {@link Bean @Bean} methods.
|
||||
* For more details see the Javadoc of {@link EnableWs @EnableWs}.
|
||||
*
|
||||
* <p>This class registers the following {@link EndpointMapping}s:
|
||||
* This is the main class providing the configuration behind the Spring Web Services Java config. It is typically
|
||||
* imported by adding {@link EnableWs @EnableWs} to an application {@link Configuration @Configuration} class. An
|
||||
* alternative, more advanced option is to extend directly from this class and override methods as necessary remembering
|
||||
* to add {@link Configuration @Configuration} to the subclass and {@link Bean @Bean} to overridden {@link Bean @Bean}
|
||||
* methods. For more details see the Javadoc of {@link EnableWs @EnableWs}.
|
||||
* <p>
|
||||
* This class registers the following {@link EndpointMapping}s:
|
||||
* <ul>
|
||||
* <li>{@link PayloadRootAnnotationMethodEndpointMapping}
|
||||
* ordered at 0 for mapping requests to {@link PayloadRoot @PayloadRoot} annotated
|
||||
* controller methods.
|
||||
* <li>{@link SoapActionAnnotationMethodEndpointMapping}
|
||||
* ordered at 1 for mapping requests to {@link SoapAction @SoapAction} annotated
|
||||
* controller methods.
|
||||
* <li>{@link AnnotationActionEndpointMapping}
|
||||
* ordered at 2 for mapping requests to {@link Action @Action} annotated
|
||||
* controller methods.
|
||||
* <li>{@link PayloadRootAnnotationMethodEndpointMapping} ordered at 0 for mapping requests to
|
||||
* {@link PayloadRoot @PayloadRoot} annotated controller methods.
|
||||
* <li>{@link SoapActionAnnotationMethodEndpointMapping} ordered at 1 for mapping requests to
|
||||
* {@link SoapAction @SoapAction} annotated controller methods.
|
||||
* <li>{@link AnnotationActionEndpointMapping} ordered at 2 for mapping requests to {@link Action @Action} annotated
|
||||
* controller methods.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Registers one {@link EndpointAdapter}:
|
||||
* <p>
|
||||
* Registers one {@link EndpointAdapter}:
|
||||
* <ul>
|
||||
* <li>{@link DefaultMethodEndpointAdapter}
|
||||
* for processing requests with annotated endpoint methods.
|
||||
* <li>{@link DefaultMethodEndpointAdapter} for processing requests with annotated endpoint methods.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Registers the following {@link EndpointExceptionResolver}s:
|
||||
* <p>
|
||||
* Registers the following {@link EndpointExceptionResolver}s:
|
||||
* <ul>
|
||||
* <li>{@link SoapFaultAnnotationExceptionResolver} for handling exceptions
|
||||
* annotated with {@link SoapFault @SoapFault}.
|
||||
* <li>{@link SimpleSoapExceptionResolver} for creating default exceptions.
|
||||
* <li>{@link SoapFaultAnnotationExceptionResolver} for handling exceptions annotated with {@link SoapFault @SoapFault}.
|
||||
* <li>{@link SimpleSoapExceptionResolver} for creating default exceptions.
|
||||
* </ul>
|
||||
*
|
||||
* @see EnableWs
|
||||
* @see WsConfigurer
|
||||
* @see WsConfigurerAdapter
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.2
|
||||
*/
|
||||
@@ -86,48 +78,43 @@ public class WsConfigurationSupport {
|
||||
private List<EndpointInterceptor> interceptors;
|
||||
|
||||
/**
|
||||
* Returns a {@link PayloadRootAnnotationMethodEndpointMapping} ordered at 0 for
|
||||
* mapping requests to annotated endpoints.
|
||||
* Returns a {@link PayloadRootAnnotationMethodEndpointMapping} ordered at 0 for mapping requests to annotated
|
||||
* endpoints.
|
||||
*/
|
||||
@Bean
|
||||
public PayloadRootAnnotationMethodEndpointMapping payloadRootAnnotationMethodEndpointMapping() {
|
||||
PayloadRootAnnotationMethodEndpointMapping endpointMapping =
|
||||
new PayloadRootAnnotationMethodEndpointMapping();
|
||||
PayloadRootAnnotationMethodEndpointMapping endpointMapping = new PayloadRootAnnotationMethodEndpointMapping();
|
||||
endpointMapping.setOrder(0);
|
||||
endpointMapping.setInterceptors(getInterceptors());
|
||||
return endpointMapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link SoapActionAnnotationMethodEndpointMapping} ordered at 1 for
|
||||
* mapping requests to annotated endpoints.
|
||||
* Returns a {@link SoapActionAnnotationMethodEndpointMapping} ordered at 1 for mapping requests to annotated
|
||||
* endpoints.
|
||||
*/
|
||||
@Bean
|
||||
public SoapActionAnnotationMethodEndpointMapping soapActionAnnotationMethodEndpointMapping() {
|
||||
SoapActionAnnotationMethodEndpointMapping endpointMapping =
|
||||
new SoapActionAnnotationMethodEndpointMapping();
|
||||
SoapActionAnnotationMethodEndpointMapping endpointMapping = new SoapActionAnnotationMethodEndpointMapping();
|
||||
endpointMapping.setOrder(1);
|
||||
endpointMapping.setInterceptors(getInterceptors());
|
||||
return endpointMapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link AnnotationActionEndpointMapping} ordered at 2 for
|
||||
* mapping requests to annotated endpoints.
|
||||
* Returns a {@link AnnotationActionEndpointMapping} ordered at 2 for mapping requests to annotated endpoints.
|
||||
*/
|
||||
@Bean
|
||||
public AnnotationActionEndpointMapping annotationActionEndpointMapping() {
|
||||
AnnotationActionEndpointMapping endpointMapping =
|
||||
new AnnotationActionEndpointMapping();
|
||||
AnnotationActionEndpointMapping endpointMapping = new AnnotationActionEndpointMapping();
|
||||
endpointMapping.setOrder(2);
|
||||
endpointMapping.setPostInterceptors(getInterceptors());
|
||||
return endpointMapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide access to the shared handler interceptors used to configure
|
||||
* {@link EndpointMapping} instances with. This method cannot be overridden,
|
||||
* use {@link #addInterceptors(List)} instead.
|
||||
* Provide access to the shared handler interceptors used to configure {@link EndpointMapping} instances with. This
|
||||
* method cannot be overridden, use {@link #addInterceptors(List)} instead.
|
||||
*/
|
||||
protected final EndpointInterceptor[] getInterceptors() {
|
||||
if (interceptors == null) {
|
||||
@@ -138,29 +125,25 @@ public class WsConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method to add endpoint interceptors. Override this method to add Spring-WS
|
||||
* interceptors for pre- and post-processing of endpoint invocation.
|
||||
* Template method to add endpoint interceptors. Override this method to add Spring-WS interceptors for pre- and
|
||||
* post-processing of endpoint invocation.
|
||||
*/
|
||||
protected void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
}
|
||||
protected void addInterceptors(List<EndpointInterceptor> interceptors) {}
|
||||
|
||||
/**
|
||||
* Returns a {@link DefaultMethodEndpointAdapter} for processing requests
|
||||
* through annotated endpoint methods. Consider overriding one of these
|
||||
* other more fine-grained methods:
|
||||
* Returns a {@link DefaultMethodEndpointAdapter} for processing requests through annotated endpoint methods. Consider
|
||||
* overriding one of these other more fine-grained methods:
|
||||
* <ul>
|
||||
* <li>{@link #addArgumentResolvers(List)} for adding custom argument resolvers.
|
||||
* <li>{@link #addReturnValueHandlers(List)} for adding custom return value handlers.
|
||||
* <li>{@link #addArgumentResolvers(List)} for adding custom argument resolvers.
|
||||
* <li>{@link #addReturnValueHandlers(List)} for adding custom return value handlers.
|
||||
* </ul>
|
||||
*/
|
||||
@Bean
|
||||
public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
|
||||
List<MethodArgumentResolver> argumentResolvers =
|
||||
new ArrayList<MethodArgumentResolver>();
|
||||
List<MethodArgumentResolver> argumentResolvers = new ArrayList<MethodArgumentResolver>();
|
||||
addArgumentResolvers(argumentResolvers);
|
||||
|
||||
List<MethodReturnValueHandler> returnValueHandlers =
|
||||
new ArrayList<MethodReturnValueHandler>();
|
||||
List<MethodReturnValueHandler> returnValueHandlers = new ArrayList<MethodReturnValueHandler>();
|
||||
addReturnValueHandlers(returnValueHandlers);
|
||||
|
||||
DefaultMethodEndpointAdapter adapter = new DefaultMethodEndpointAdapter();
|
||||
@@ -171,27 +154,21 @@ public class WsConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom {@link MethodArgumentResolver}s to use in addition to
|
||||
* the ones registered by default.
|
||||
* @param argumentResolvers the list of custom converters;
|
||||
* initially an empty list.
|
||||
* Add custom {@link MethodArgumentResolver}s to use in addition to the ones registered by default.
|
||||
*
|
||||
* @param argumentResolvers the list of custom converters; initially an empty list.
|
||||
*/
|
||||
protected void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
|
||||
}
|
||||
protected void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {}
|
||||
|
||||
/**
|
||||
* Add custom {@link MethodReturnValueHandler}s in addition to the
|
||||
* ones registered by default.
|
||||
* @param returnValueHandlers the list of custom handlers;
|
||||
* initially an empty list.
|
||||
* Add custom {@link MethodReturnValueHandler}s in addition to the ones registered by default.
|
||||
*
|
||||
* @param returnValueHandlers the list of custom handlers; initially an empty list.
|
||||
*/
|
||||
protected void addReturnValueHandlers(
|
||||
List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
}
|
||||
protected void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers) {}
|
||||
|
||||
/**
|
||||
* Returns a {@link SoapFaultAnnotationExceptionResolver} ordered at 0 for handling
|
||||
* endpoint exceptions.
|
||||
* Returns a {@link SoapFaultAnnotationExceptionResolver} ordered at 0 for handling endpoint exceptions.
|
||||
*/
|
||||
@Bean
|
||||
public SoapFaultAnnotationExceptionResolver soapFaultAnnotationExceptionResolver() {
|
||||
@@ -202,9 +179,8 @@ public class WsConfigurationSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link SimpleSoapExceptionResolver} ordered at
|
||||
* {@linkplain Ordered#LOWEST_PRECEDENCE lowest precedence} for handling endpoint
|
||||
* exceptions.
|
||||
* Returns a {@link SimpleSoapExceptionResolver} ordered at {@linkplain Ordered#LOWEST_PRECEDENCE lowest precedence}
|
||||
* for handling endpoint exceptions.
|
||||
*/
|
||||
@Bean
|
||||
public SimpleSoapExceptionResolver simpleSoapExceptionResolver() {
|
||||
|
||||
@@ -7,13 +7,12 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResol
|
||||
import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler;
|
||||
|
||||
/**
|
||||
* Defines callback methods to customize the Java-based configuration for
|
||||
* Spring Web Services enabled via {@link EnableWs @EnableWs}.
|
||||
*
|
||||
* <p>{@code @EnableWs}-annotated configuration classes may implement
|
||||
* this interface to be called back and given a chance to customize the
|
||||
* default configuration. Consider extending {@link WsConfigurerAdapter},
|
||||
* which provides a stub implementation of all interface methods.
|
||||
* Defines callback methods to customize the Java-based configuration for Spring Web Services enabled via
|
||||
* {@link EnableWs @EnableWs}.
|
||||
* <p>
|
||||
* {@code @EnableWs}-annotated configuration classes may implement this interface to be called back and given a chance
|
||||
* to customize the default configuration. Consider extending {@link WsConfigurerAdapter}, which provides a stub
|
||||
* implementation of all interface methods.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.2
|
||||
@@ -21,22 +20,23 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHa
|
||||
public interface WsConfigurer {
|
||||
|
||||
/**
|
||||
* Add {@link EndpointInterceptor}s for pre- and post-processing of
|
||||
* endpoint method invocations.
|
||||
* Add {@link EndpointInterceptor}s for pre- and post-processing of endpoint method invocations.
|
||||
*/
|
||||
void addInterceptors(List<EndpointInterceptor> interceptors);
|
||||
|
||||
/**
|
||||
* Add resolvers to support custom endpoint method argument types.
|
||||
*
|
||||
* @param argumentResolvers initially an empty list
|
||||
*/
|
||||
void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers);
|
||||
|
||||
/**
|
||||
* Add handlers to support custom controller method return value types.
|
||||
* <p>Using this option does not override the built-in support for handling
|
||||
* return values. To customize the built-in support for handling return
|
||||
* values, configure RequestMappingHandlerAdapter directly.
|
||||
* <p>
|
||||
* Using this option does not override the built-in support for handling return values. To customize the built-in
|
||||
* support for handling return values, configure RequestMappingHandlerAdapter directly.
|
||||
*
|
||||
* @param returnValueHandlers initially an empty list
|
||||
*/
|
||||
void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers);
|
||||
|
||||
@@ -7,8 +7,8 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResol
|
||||
import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler;
|
||||
|
||||
/**
|
||||
* An default implementation of {@link WsConfigurer} with empty methods allowing
|
||||
* sub-classes to override only the methods they're interested in.
|
||||
* An default implementation of {@link WsConfigurer} with empty methods allowing sub-classes to override only the
|
||||
* methods they're interested in.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.2
|
||||
@@ -17,27 +17,27 @@ public class WsConfigurerAdapter implements WsConfigurer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>This implementation is empty.
|
||||
* <p>
|
||||
* This implementation is empty.
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
}
|
||||
public void addInterceptors(List<EndpointInterceptor> interceptors) {}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>This implementation is empty.
|
||||
* <p>
|
||||
* This implementation is empty.
|
||||
*/
|
||||
@Override
|
||||
public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {
|
||||
}
|
||||
public void addArgumentResolvers(List<MethodArgumentResolver> argumentResolvers) {}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>This implementation is empty.
|
||||
* <p>
|
||||
* This implementation is empty.
|
||||
*/
|
||||
@Override
|
||||
public void addReturnValueHandlers(
|
||||
List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
public void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ public class WsConfigurerComposite implements WsConfigurer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReturnValueHandlers(
|
||||
List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
public void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers) {
|
||||
for (WsConfigurer delegate : delegates) {
|
||||
delegate.addReturnValueHandlers(returnValueHandlers);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
public abstract class AbstractMessageContext implements MessageContext {
|
||||
|
||||
/**
|
||||
* Keys are {@code Strings}, values are {@code Objects}. Lazily initialized by
|
||||
* {@code getProperties()}.
|
||||
* Keys are {@code Strings}, values are {@code Objects}. Lazily initialized by {@code getProperties()}.
|
||||
*/
|
||||
private Map<String, Object> properties;
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ public class DefaultMessageContext extends AbstractMessageContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new instance of the {@code DefaultMessageContext} with the given request message and message
|
||||
* factory.
|
||||
* Construct a new instance of the {@code DefaultMessageContext} with the given request message and message factory.
|
||||
*/
|
||||
public DefaultMessageContext(WebServiceMessage request, WebServiceMessageFactory messageFactory) {
|
||||
Assert.notNull(request, "request must not be null");
|
||||
|
||||
@@ -24,11 +24,11 @@ import org.springframework.ws.server.EndpointInterceptor;
|
||||
|
||||
/**
|
||||
* Context holder for message requests.
|
||||
*
|
||||
* <p>Contains both the message request as well as the response. Response message are usually lazily created (but do not
|
||||
* <p>
|
||||
* Contains both the message request as well as the response. Response message are usually lazily created (but do not
|
||||
* have to be).
|
||||
*
|
||||
* <p>Also contains properties, which can be used to by {@link EndpointInterceptor interceptors} to pass information on to
|
||||
* <p>
|
||||
* Also contains properties, which can be used to by {@link EndpointInterceptor interceptors} to pass information on to
|
||||
* endpoints.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -78,16 +78,16 @@ public interface MessageContext {
|
||||
* Reads a response message from the given input stream.
|
||||
*
|
||||
* @param inputStream the stream to read the response from
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws IOException in case of I/O errors
|
||||
* @throws IllegalStateException if a response has already been created
|
||||
*/
|
||||
void readResponse(InputStream inputStream) throws IOException;
|
||||
|
||||
/**
|
||||
* Sets the name and value of a property associated with the {@code MessageContext}. If the
|
||||
* {@code MessageContext} contains a value of the same property, the old value is replaced.
|
||||
* Sets the name and value of a property associated with the {@code MessageContext}. If the {@code MessageContext}
|
||||
* contains a value of the same property, the old value is replaced.
|
||||
*
|
||||
* @param name name of the property associated with the value
|
||||
* @param name name of the property associated with the value
|
||||
* @param value value of the property
|
||||
*/
|
||||
void setProperty(String name, Object value);
|
||||
@@ -122,4 +122,4 @@ public interface MessageContext {
|
||||
*/
|
||||
String[] getPropertyNames();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.DataSource;
|
||||
import javax.activation.FileDataSource;
|
||||
@@ -49,8 +50,8 @@ public abstract class AbstractMimeMessage implements MimeMessage {
|
||||
Assert.hasLength(contentId, "contentId must not be empty");
|
||||
Assert.notNull(inputStreamSource, "InputStreamSource must not be null");
|
||||
if (inputStreamSource instanceof Resource && ((Resource) inputStreamSource).isOpen()) {
|
||||
throw new IllegalArgumentException("Passed-in Resource contains an open stream: invalid argument. " +
|
||||
"MIME requires an InputStreamSource that creates a fresh stream for every call.");
|
||||
throw new IllegalArgumentException("Passed-in Resource contains an open stream: invalid argument. "
|
||||
+ "MIME requires an InputStreamSource that creates a fresh stream for every call.");
|
||||
}
|
||||
DataHandler dataHandler = new DataHandler(new InputStreamSourceDataSource(inputStreamSource, contentType));
|
||||
return addAttachment(contentId, dataHandler);
|
||||
@@ -93,8 +94,7 @@ public abstract class AbstractMimeMessage implements MimeMessage {
|
||||
if (inputStreamSource instanceof Resource) {
|
||||
Resource resource = (Resource) inputStreamSource;
|
||||
return resource.getFilename();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new UnsupportedOperationException("DataSource name not available");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.mime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
|
||||
/**
|
||||
@@ -45,8 +46,8 @@ public interface Attachment {
|
||||
String getContentType();
|
||||
|
||||
/**
|
||||
* Return an {@code InputStream} to read the contents of the attachment from. The user is responsible for
|
||||
* closing the stream.
|
||||
* Return an {@code InputStream} to read the contents of the attachment from. The user is responsible for closing the
|
||||
* stream.
|
||||
*
|
||||
* @return the contents of the file as stream, or an empty stream if empty
|
||||
* @throws IOException in case of access I/O errors
|
||||
|
||||
@@ -18,14 +18,15 @@ package org.springframework.ws.mime;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
|
||||
import org.springframework.core.io.InputStreamSource;
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
|
||||
/**
|
||||
* Represents a Web service message with MIME attachments. Attachments can be added as a file, an {@link
|
||||
* InputStreamSource}, or a {@link DataHandler}.
|
||||
* Represents a Web service message with MIME attachments. Attachments can be added as a file, an
|
||||
* {@link InputStreamSource}, or a {@link DataHandler}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see Attachment
|
||||
@@ -36,8 +37,9 @@ public interface MimeMessage extends WebServiceMessage {
|
||||
/**
|
||||
* Indicates whether this message is a XOP package.
|
||||
*
|
||||
* @return {@code true} when the constraints specified in <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#identifying_xop_documents">Identifying
|
||||
* XOP Documents</a> are met.
|
||||
* @return {@code true} when the constraints specified in
|
||||
* <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#identifying_xop_documents">Identifying XOP
|
||||
* Documents</a> are met.
|
||||
* @see <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#xop_packages">XOP Packages</a>
|
||||
*/
|
||||
boolean isXopPackage();
|
||||
@@ -69,12 +71,12 @@ public interface MimeMessage extends WebServiceMessage {
|
||||
|
||||
/**
|
||||
* Add an attachment to the message, taking the content from a {@link File}.
|
||||
*
|
||||
* <p>The content type will be determined by the name of the given content file. Do not use this for temporary files
|
||||
* with arbitrary filenames (possibly ending in ".tmp" or the like)!
|
||||
* <p>
|
||||
* The content type will be determined by the name of the given content file. Do not use this for temporary files with
|
||||
* arbitrary filenames (possibly ending in ".tmp" or the like)!
|
||||
*
|
||||
* @param contentId the content Id of the attachment
|
||||
* @param file the file to take the content from
|
||||
* @param file the file to take the content from
|
||||
* @return the added attachment
|
||||
* @throws AttachmentException in case of errors
|
||||
*/
|
||||
@@ -82,14 +84,14 @@ public interface MimeMessage extends WebServiceMessage {
|
||||
|
||||
/**
|
||||
* Add an attachment to the message, taking the content from an {@link InputStreamSource}.
|
||||
*
|
||||
* <p>Note that the stream returned by the source needs to be a <em>fresh one on each call</em>, as underlying
|
||||
* <p>
|
||||
* Note that the stream returned by the source needs to be a <em>fresh one on each call</em>, as underlying
|
||||
* implementations can invoke {@link InputStreamSource#getInputStream()} multiple times.
|
||||
*
|
||||
* @param contentId the content Id of the attachment
|
||||
* @param contentId the content Id of the attachment
|
||||
* @param inputStreamSource the resource to take the content from (all of Spring's Resource implementations can be
|
||||
* passed in here)
|
||||
* @param contentType the content type to use for the element
|
||||
* passed in here)
|
||||
* @param contentType the content type to use for the element
|
||||
* @return the added attachment
|
||||
* @throws AttachmentException in case of errors
|
||||
* @see org.springframework.core.io.Resource
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.pox.dom;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
@@ -26,15 +27,14 @@ import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.pox.PoxMessage;
|
||||
import org.springframework.ws.transport.TransportConstants;
|
||||
import org.springframework.ws.transport.TransportOutputStream;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Implementation of the {@code PoxMessage} interface that is based on a DOM Document.
|
||||
@@ -110,8 +110,7 @@ public class DomPoxMessage implements PoxMessage {
|
||||
transportOutputStream.addHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType);
|
||||
}
|
||||
transformer.transform(getPayloadSource(), new StreamResult(outputStream));
|
||||
}
|
||||
catch (TransformerException ex) {
|
||||
} catch (TransformerException ex) {
|
||||
throw new DomPoxMessageException("Could write document: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,18 +18,18 @@ package org.springframework.ws.pox.dom;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.WebServiceMessageFactory;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.springframework.xml.DocumentBuilderFactoryUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link WebServiceMessageFactory} interface that creates a {@link DomPoxMessage}.
|
||||
@@ -61,7 +61,7 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
|
||||
*/
|
||||
public DomPoxMessageFactory(DocumentBuilderFactory documentBuilderFactory) {
|
||||
this.documentBuilderFactory = documentBuilderFactory;
|
||||
|
||||
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
documentBuilderFactory.setValidating(false);
|
||||
documentBuilderFactory.setExpandEntityReferences(false);
|
||||
@@ -84,8 +84,7 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the XML parser should expand entity reference nodes. Default is
|
||||
* {@code false}.
|
||||
* Set if the XML parser should expand entity reference nodes. Default is {@code false}.
|
||||
*/
|
||||
public void setExpandEntityReferences(boolean expandEntityRef) {
|
||||
documentBuilderFactory.setExpandEntityReferences(expandEntityRef);
|
||||
@@ -97,11 +96,9 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
Document request = documentBuilder.newDocument();
|
||||
return new DomPoxMessage(request, createTransformer(), contentType);
|
||||
}
|
||||
catch (ParserConfigurationException ex) {
|
||||
} catch (ParserConfigurationException ex) {
|
||||
throw new DomPoxMessageException("Could not create message context", ex);
|
||||
}
|
||||
catch (TransformerConfigurationException ex) {
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
throw new DomPoxMessageException("Could not create transformer", ex);
|
||||
}
|
||||
}
|
||||
@@ -112,14 +109,11 @@ public class DomPoxMessageFactory extends TransformerObjectSupport implements We
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
Document request = documentBuilder.parse(inputStream);
|
||||
return new DomPoxMessage(request, createTransformer(), contentType);
|
||||
}
|
||||
catch (ParserConfigurationException ex) {
|
||||
} catch (ParserConfigurationException ex) {
|
||||
throw new DomPoxMessageException("Could not create message context", ex);
|
||||
}
|
||||
catch (SAXException ex) {
|
||||
} catch (SAXException ex) {
|
||||
throw new DomPoxMessageException("Could not parse request message", ex);
|
||||
}
|
||||
catch (TransformerConfigurationException ex) {
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
throw new DomPoxMessageException("Could not create transformer", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Interface that must be implemented for each endpoint type to handle a message request. This interface is used to
|
||||
* allow the {@code MessageDispatcher} to be indefinitely extensible. It accesses all installed endpoints through
|
||||
* this interface, meaning that is does not contain code specific to any endpoint type.
|
||||
*
|
||||
* <p>This interface is not intended for application developers. It is available for those who want to develop their own
|
||||
* allow the {@code MessageDispatcher} to be indefinitely extensible. It accesses all installed endpoints through this
|
||||
* interface, meaning that is does not contain code specific to any endpoint type.
|
||||
* <p>
|
||||
* This interface is not intended for application developers. It is available for those who want to develop their own
|
||||
* message flow.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -34,8 +34,8 @@ public interface EndpointAdapter {
|
||||
|
||||
/**
|
||||
* Does this {@code EndpointAdapter} support the given {@code endpoint}?
|
||||
*
|
||||
* <p>Typical {@code EndpointAdapters} will base the decision on the endpoint type.
|
||||
* <p>
|
||||
* Typical {@code EndpointAdapters} will base the decision on the endpoint type.
|
||||
*
|
||||
* @param endpoint endpoint object to check
|
||||
* @return {@code true} if this {@code EndpointAdapter} supports the supplied {@code endpoint}
|
||||
@@ -46,8 +46,8 @@ public interface EndpointAdapter {
|
||||
* Use the given {@code endpoint} to handle the request.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
* @param endpoint the endpoint to use. This object must have previously been passed to the {@link
|
||||
* #supports(Object)} method of this interface, which must have returned {@code true}
|
||||
* @param endpoint the endpoint to use. This object must have previously been passed to the {@link #supports(Object)}
|
||||
* method of this interface, which must have returned {@code true}
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
void invoke(MessageContext messageContext, Object endpoint) throws Exception;
|
||||
|
||||
@@ -30,8 +30,8 @@ public interface EndpointExceptionResolver {
|
||||
* Try to resolve the given exception that got thrown during on endpoint execution.
|
||||
*
|
||||
* @param messageContext current message context
|
||||
* @param endpoint the executed endpoint, or null if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during endpoint execution
|
||||
* @param endpoint the executed endpoint, or null if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during endpoint execution
|
||||
* @return {@code true} if resolved; {@code false} otherwise
|
||||
*/
|
||||
boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex);
|
||||
|
||||
@@ -22,17 +22,15 @@ import org.springframework.ws.context.MessageContext;
|
||||
* Workflow interface that allows for customized endpoint invocation chains. Applications can register any number of
|
||||
* existing or custom interceptors for certain groups of endpoints, to add common preprocessing behavior without needing
|
||||
* to modify each endpoint implementation.
|
||||
*
|
||||
* <p>An {@code EndpointInterceptor} gets called before the appropriate {@link EndpointAdapter} triggers the
|
||||
* invocation of the endpoint itself. This mechanism can be used for a large field of preprocessing aspects, e.g. for
|
||||
* authorization checks, or message header checks. Its main purpose is to allow for factoring out repetitive endpoint
|
||||
* code.
|
||||
*
|
||||
* <p>Typically an interceptor chain is defined per {@link EndpointMapping} bean, sharing its granularity. To be able to
|
||||
* <p>
|
||||
* An {@code EndpointInterceptor} gets called before the appropriate {@link EndpointAdapter} triggers the invocation of
|
||||
* the endpoint itself. This mechanism can be used for a large field of preprocessing aspects, e.g. for authorization
|
||||
* checks, or message header checks. Its main purpose is to allow for factoring out repetitive endpoint code.
|
||||
* <p>
|
||||
* Typically an interceptor chain is defined per {@link EndpointMapping} bean, sharing its granularity. To be able to
|
||||
* apply a certain interceptor chain to a group of handlers, one needs to map the desired handlers via one
|
||||
* {@code EndpointMapping} bean. The interceptors themselves are defined as beans in the application context,
|
||||
* referenced by the mapping bean definition via its {@code interceptors} property (in XML: a <list> of
|
||||
* <ref>).
|
||||
* {@code EndpointMapping} bean. The interceptors themselves are defined as beans in the application context, referenced
|
||||
* by the mapping bean definition via its {@code interceptors} property (in XML: a <list> of <ref>).
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see EndpointInvocationChain#getInterceptors()
|
||||
@@ -45,15 +43,15 @@ public interface EndpointInterceptor {
|
||||
/**
|
||||
* Processes the incoming request message. Called after {@link EndpointMapping} determined an appropriate endpoint
|
||||
* object, but before {@link EndpointAdapter} invokes the endpoint.
|
||||
*
|
||||
* <p>{@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* <p>
|
||||
* {@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* with the endpoint itself at the end. With this method, each interceptor can decide to abort the chain, typically
|
||||
* creating a custom response.
|
||||
*
|
||||
* @param messageContext contains the incoming request message
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the request interceptor chain; {@code false} to indicate
|
||||
* blocking of the request endpoint chain, <em>without invoking the endpoint</em>
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the request interceptor chain; {@code false} to indicate blocking of
|
||||
* the request endpoint chain, <em>without invoking the endpoint</em>
|
||||
* @throws Exception in case of errors
|
||||
* @see MessageContext#getRequest()
|
||||
*/
|
||||
@@ -62,17 +60,17 @@ public interface EndpointInterceptor {
|
||||
/**
|
||||
* Processes the outgoing response message. Called after {@link EndpointAdapter} actually invoked the endpoint. Can
|
||||
* manipulate the response, if any, by adding new headers, etc.
|
||||
*
|
||||
* <p>{@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* <p>
|
||||
* {@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* with the endpoint itself at the end. With this method, each interceptor can post-process an invocation, getting
|
||||
* applied in inverse order of the execution chain.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* @param messageContext contains both request and response messages
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the response interceptor chain; {@code false} to indicate
|
||||
* blocking of the response endpoint chain.
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the response interceptor chain; {@code false} to indicate blocking
|
||||
* of the response endpoint chain.
|
||||
* @throws Exception in case of errors
|
||||
* @see MessageContext#getRequest()
|
||||
* @see MessageContext#hasResponse()
|
||||
@@ -83,31 +81,31 @@ public interface EndpointInterceptor {
|
||||
/**
|
||||
* Processes the outgoing response fault. Called after {@link EndpointAdapter} actually invoked the endpoint. Can
|
||||
* manipulate the response, if any, by adding new headers, etc.
|
||||
*
|
||||
* <p>{@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* <p>
|
||||
* {@link MessageDispatcher} processes an endpoint in an invocation chain, consisting of any number of interceptors,
|
||||
* with the endpoint itself at the end. With this method, each interceptor can post-process an invocation, getting
|
||||
* applied in inverse order of the execution chain.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* @param messageContext contains both request and response messages, the response should contains a Fault
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the response interceptor chain; {@code false} to indicate
|
||||
* blocking of the response handler chain.
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to continue processing of the response interceptor chain; {@code false} to indicate blocking
|
||||
* of the response handler chain.
|
||||
*/
|
||||
boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception;
|
||||
|
||||
/**
|
||||
* Callback after completion of request and response (fault) processing. Will be called on any outcome of endpoint
|
||||
* invocation, thus allows for proper resource cleanup.
|
||||
*
|
||||
* <p>Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
*
|
||||
* <p>As with the {@link #handleResponse} method, the method will be invoked on each interceptor in the chain in
|
||||
* reverse order, so the first interceptor will be the last to be invoked.
|
||||
* <p>
|
||||
* Note: Will only be called if this interceptor's {@link #handleRequest} method has successfully completed.
|
||||
* <p>
|
||||
* As with the {@link #handleResponse} method, the method will be invoked on each interceptor in the chain in reverse
|
||||
* order, so the first interceptor will be the last to be invoked.
|
||||
*
|
||||
* @param messageContext contains both request and response messages, the response should contains a Fault
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @param ex exception thrown on handler execution, if any
|
||||
* @throws Exception in case of errors
|
||||
* @since 2.0.2
|
||||
|
||||
@@ -41,7 +41,7 @@ public class EndpointInvocationChain {
|
||||
/**
|
||||
* Create new {@code EndpointInvocationChain}.
|
||||
*
|
||||
* @param endpoint the endpoint object to invoke
|
||||
* @param endpoint the endpoint object to invoke
|
||||
* @param interceptors the array of interceptors to apply
|
||||
*/
|
||||
public EndpointInvocationChain(Object endpoint, EndpointInterceptor[] interceptors) {
|
||||
|
||||
@@ -20,15 +20,14 @@ import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Defines a mapping between message requests and endpoint objects.
|
||||
*
|
||||
* <p>This class can be implemented by application developers, although this is not always necessary, as
|
||||
* <p>
|
||||
* This class can be implemented by application developers, although this is not always necessary, as
|
||||
* {@code PayloadRootQNameEndpointMapping} and {@code SoapActionEndpointMapping} are included.
|
||||
*
|
||||
* <p>HandlerMapping implementations can support mapped interceptors but do not have to. An endpoint will always be wrapped
|
||||
* in a {@code EndpointExecutionChain} instance, optionally accompanied by some {@code EndpointInterceptor}
|
||||
* instances. The {@code MessageDispacher} will first call each {@code EndpointInterceptor}'s
|
||||
* {@code handlerRequest} method in the given order, finally invoking the endpoint itself if all
|
||||
* {@code handlerRequest} methods have returned {@code true}.
|
||||
* <p>
|
||||
* HandlerMapping implementations can support mapped interceptors but do not have to. An endpoint will always be wrapped
|
||||
* in a {@code EndpointExecutionChain} instance, optionally accompanied by some {@code EndpointInterceptor} instances.
|
||||
* The {@code MessageDispacher} will first call each {@code EndpointInterceptor}'s {@code handlerRequest} method in the
|
||||
* given order, finally invoking the endpoint itself if all {@code handlerRequest} methods have returned {@code true}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
|
||||
@@ -41,17 +40,17 @@ public interface EndpointMapping {
|
||||
/**
|
||||
* Returns an endpoint and any interceptors for this message context. The choice may be made on message contents,
|
||||
* transport request url, a routing table, or any factor the implementing class chooses.
|
||||
* <p>
|
||||
* The returned {@code EndpointExecutionChain} contains an endpoint Object, rather than even a tag interface, so that
|
||||
* endpoints are not constrained in any way. For example, a {@code EndpointAdapter} could be written to allow another
|
||||
* framework's endpoint objects to be used.
|
||||
* <p>
|
||||
* Returns {@code null} if no match was found. This is by design. The {@code MessageDispatcher} will query all
|
||||
* registered {@code EndpointMapping} beans to find a match, and only decide there is an error if none can find an
|
||||
* endpoint.
|
||||
*
|
||||
* <p>The returned {@code EndpointExecutionChain} contains an endpoint Object, rather than even a tag interface,
|
||||
* so that endpoints are not constrained in any way. For example, a {@code EndpointAdapter} could be written to
|
||||
* allow another framework's endpoint objects to be used.
|
||||
*
|
||||
* <p>Returns {@code null} if no match was found. This is by design. The {@code MessageDispatcher} will query
|
||||
* all registered {@code EndpointMapping} beans to find a match, and only decide there is an error if none can
|
||||
* find an endpoint.
|
||||
*
|
||||
* @return a HandlerExecutionChain instance containing endpoint object and any interceptors, or {@code null} if
|
||||
* no mapping is found
|
||||
* @return a HandlerExecutionChain instance containing endpoint object and any interceptors, or {@code null} if no
|
||||
* mapping is found
|
||||
* @throws Exception if there is an internal error
|
||||
*/
|
||||
EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
@@ -49,24 +48,24 @@ import org.springframework.ws.transport.WebServiceMessageReceiver;
|
||||
|
||||
/**
|
||||
* Central dispatcher for use within Spring-WS, dispatching Web service messages to registered endpoints.
|
||||
*
|
||||
* <p>This dispatcher is quite similar to Spring MVCs {@link DispatcherServlet}. Just like its counterpart, this dispatcher
|
||||
* <p>
|
||||
* This dispatcher is quite similar to Spring MVCs {@link DispatcherServlet}. Just like its counterpart, this dispatcher
|
||||
* is very flexible. This class is SOAP agnostic; in typical SOAP Web Services, the {@link SoapMessageDispatcher}
|
||||
* subclass is used.
|
||||
* <ul>
|
||||
* <li>It can use any {@link EndpointMapping} implementation - whether standard, or provided as
|
||||
* part of an application - to control the routing of request messages to endpoint objects. Endpoint mappings can be
|
||||
* registered using the {@link #setEndpointMappings(List) endpointMappings} property.</li>
|
||||
* <li>It can use any {@link EndpointAdapter}; this allows one to use any endpoint interface or form. Defaults to
|
||||
* the {@link MessageEndpointAdapter} and {@link PayloadEndpointAdapter}, for {@link MessageEndpoint} and
|
||||
* <li>It can use any {@link EndpointMapping} implementation - whether standard, or provided as part of an application -
|
||||
* to control the routing of request messages to endpoint objects. Endpoint mappings can be registered using the
|
||||
* {@link #setEndpointMappings(List) endpointMappings} property.</li>
|
||||
* <li>It can use any {@link EndpointAdapter}; this allows one to use any endpoint interface or form. Defaults to the
|
||||
* {@link MessageEndpointAdapter} and {@link PayloadEndpointAdapter}, for {@link MessageEndpoint} and
|
||||
* {@link PayloadEndpoint}, respectively, and the
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.MessageMethodEndpointAdapter MessageMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.PayloadMethodEndpointAdapter PayloadMethodEndpointAdapter}.
|
||||
* Additional endpoint adapters can be added through the {@link #setEndpointAdapters(List) endpointAdapters} property.</li>
|
||||
* <li>Its exception resolution strategy can be specified via a
|
||||
* {@link EndpointExceptionResolver}, for example mapping certain exceptions to SOAP Faults. Default is none. Additional
|
||||
* exception resolvers can be added through the {@link #setEndpointExceptionResolvers(List) endpointExceptionResolvers}
|
||||
* Additional endpoint adapters can be added through the {@link #setEndpointAdapters(List) endpointAdapters}
|
||||
* property.</li>
|
||||
* <li>Its exception resolution strategy can be specified via a {@link EndpointExceptionResolver}, for example mapping
|
||||
* certain exceptions to SOAP Faults. Default is none. Additional exception resolvers can be added through the
|
||||
* {@link #setEndpointExceptionResolvers(List) endpointExceptionResolvers} property.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -85,19 +84,19 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
public static final String ENDPOINT_NOT_FOUND_LOG_CATEGORY = "org.springframework.ws.server.EndpointNotFound";
|
||||
|
||||
/** Additional logger to use when no mapped endpoint is found for a request. */
|
||||
protected static final Log endpointNotFoundLogger =
|
||||
LogFactory.getLog(MessageDispatcher.ENDPOINT_NOT_FOUND_LOG_CATEGORY);
|
||||
protected static final Log endpointNotFoundLogger = LogFactory
|
||||
.getLog(MessageDispatcher.ENDPOINT_NOT_FOUND_LOG_CATEGORY);
|
||||
|
||||
/** Log category to use for message tracing. */
|
||||
public static final String MESSAGE_TRACING_LOG_CATEGORY = "org.springframework.ws.server.MessageTracing";
|
||||
|
||||
/** Additional logger to use for sent message tracing. */
|
||||
protected static final Log sentMessageTracingLogger =
|
||||
LogFactory.getLog(MessageDispatcher.MESSAGE_TRACING_LOG_CATEGORY + ".sent");
|
||||
protected static final Log sentMessageTracingLogger = LogFactory
|
||||
.getLog(MessageDispatcher.MESSAGE_TRACING_LOG_CATEGORY + ".sent");
|
||||
|
||||
/** Additional logger to use for received message tracing. */
|
||||
protected static final Log receivedMessageTracingLogger =
|
||||
LogFactory.getLog(MessageDispatcher.MESSAGE_TRACING_LOG_CATEGORY + ".received");
|
||||
protected static final Log receivedMessageTracingLogger = LogFactory
|
||||
.getLog(MessageDispatcher.MESSAGE_TRACING_LOG_CATEGORY + ".received");
|
||||
|
||||
private final DefaultStrategiesHelper defaultStrategiesHelper;
|
||||
|
||||
@@ -165,12 +164,11 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
// Let's keep a reference to the request content as it came in, it might be changed by interceptors in dispatch()
|
||||
String requestContent = "";
|
||||
if (receivedMessageTracingLogger.isTraceEnabled() || sentMessageTracingLogger.isTraceEnabled()) {
|
||||
requestContent = getMessageContent(messageContext.getRequest());
|
||||
requestContent = getMessageContent(messageContext.getRequest());
|
||||
}
|
||||
if (receivedMessageTracingLogger.isTraceEnabled()) {
|
||||
receivedMessageTracingLogger.trace("Received request [" + requestContent + "]");
|
||||
}
|
||||
else if (receivedMessageTracingLogger.isDebugEnabled()) {
|
||||
} else if (receivedMessageTracingLogger.isDebugEnabled()) {
|
||||
receivedMessageTracingLogger.debug("Received request [" + messageContext.getRequest() + "]");
|
||||
}
|
||||
dispatch(messageContext);
|
||||
@@ -178,18 +176,14 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
if (sentMessageTracingLogger.isTraceEnabled()) {
|
||||
String responseContent = getMessageContent(response);
|
||||
sentMessageTracingLogger.trace("Sent response [" + responseContent + "] for request [" +
|
||||
requestContent + "]");
|
||||
sentMessageTracingLogger.trace("Sent response [" + responseContent + "] for request [" + requestContent + "]");
|
||||
} else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
sentMessageTracingLogger
|
||||
.debug("Sent response [" + response + "] for request [" + messageContext.getRequest() + "]");
|
||||
}
|
||||
else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
sentMessageTracingLogger.debug("Sent response [" + response + "] for request [" +
|
||||
messageContext.getRequest() + "]");
|
||||
}
|
||||
}
|
||||
else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
sentMessageTracingLogger
|
||||
.debug("MessageDispatcher with name '" + beanName + "' sends no response for request [" +
|
||||
messageContext.getRequest() + "]");
|
||||
} else if (sentMessageTracingLogger.isDebugEnabled()) {
|
||||
sentMessageTracingLogger.debug("MessageDispatcher with name '" + beanName + "' sends no response for request ["
|
||||
+ messageContext.getRequest() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +197,8 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
* Dispatches the request in the given MessageContext according to the configuration.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @throws org.springframework.ws.NoEndpointFoundException
|
||||
* thrown when an endpoint cannot be resolved for the incoming message
|
||||
* @throws org.springframework.ws.NoEndpointFoundException thrown when an endpoint cannot be resolved for the incoming
|
||||
* message
|
||||
*/
|
||||
protected final void dispatch(MessageContext messageContext) throws Exception {
|
||||
EndpointInvocationChain mappedEndpoint = null;
|
||||
@@ -237,25 +231,21 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
|
||||
// Apply handleResponse methods of registered interceptors
|
||||
triggerHandleResponse(mappedEndpoint, interceptorIndex, messageContext);
|
||||
}
|
||||
catch (NoEndpointFoundException ex) {
|
||||
} catch (NoEndpointFoundException ex) {
|
||||
// No triggering of interceptors if no endpoint is found
|
||||
if (endpointNotFoundLogger.isWarnEnabled()) {
|
||||
endpointNotFoundLogger.warn("No endpoint mapping found for [" + messageContext.getRequest() + "]");
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Object endpoint = mappedEndpoint != null ? mappedEndpoint.getEndpoint() : null;
|
||||
processEndpointException(messageContext, endpoint, ex);
|
||||
triggerHandleResponse(mappedEndpoint, interceptorIndex, messageContext);
|
||||
}
|
||||
triggerAfterCompletion(mappedEndpoint, interceptorIndex, messageContext, null);
|
||||
}
|
||||
catch (NoEndpointFoundException ex) {
|
||||
} catch (NoEndpointFoundException ex) {
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
// Trigger after-completion for thrown exception.
|
||||
triggerAfterCompletion(mappedEndpoint, interceptorIndex, messageContext, ex);
|
||||
throw ex;
|
||||
@@ -272,12 +262,11 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
EndpointInvocationChain endpoint = endpointMapping.getEndpoint(messageContext);
|
||||
if (endpoint != null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Endpoint mapping [" + endpointMapping + "] maps request to endpoint [" +
|
||||
endpoint.getEndpoint() + "]");
|
||||
logger.debug(
|
||||
"Endpoint mapping [" + endpointMapping + "] maps request to endpoint [" + endpoint.getEndpoint() + "]");
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
else if (logger.isDebugEnabled()) {
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Endpoint mapping [" + endpointMapping + "] has no mapping for request");
|
||||
}
|
||||
}
|
||||
@@ -299,15 +288,15 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
return endpointAdapter;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No adapter for endpoint [" + endpoint + "]: Is your endpoint annotated with " +
|
||||
"@Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?");
|
||||
throw new IllegalStateException("No adapter for endpoint [" + endpoint + "]: Is your endpoint annotated with "
|
||||
+ "@Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?");
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for pre-processing of given invocation chain and message context. Gets called before invocation of
|
||||
* {@code handleRequest} on the interceptors.
|
||||
*
|
||||
* <p>Default implementation does nothing, and returns {@code true}.
|
||||
* <p>
|
||||
* Default implementation does nothing, and returns {@code true}.
|
||||
*
|
||||
* @param mappedEndpoint the mapped {@code EndpointInvocationChain}
|
||||
* @param messageContext the message context
|
||||
@@ -318,13 +307,12 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine an error {@code SOAPMessage} response via the registered {@code EndpointExceptionResolvers}.
|
||||
* Most likely, the response contains a {@code SOAPFault}. If no suitable resolver was found, the exception is
|
||||
* rethrown.
|
||||
* Determine an error {@code SOAPMessage} response via the registered {@code EndpointExceptionResolvers}. Most likely,
|
||||
* the response contains a {@code SOAPFault}. If no suitable resolver was found, the exception is rethrown.
|
||||
*
|
||||
* @param messageContext current SOAPMessage request
|
||||
* @param endpoint the executed endpoint, or null if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @param endpoint the executed endpoint, or null if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @throws Exception if no suitable resolver is found
|
||||
*/
|
||||
protected void processEndpointException(MessageContext messageContext, Object endpoint, Exception ex)
|
||||
@@ -345,20 +333,19 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
|
||||
/**
|
||||
* Trigger handleResponse or handleFault on the mapped EndpointInterceptors. Will just invoke said method on all
|
||||
* interceptors whose handleRequest invocation returned {@code true}, in addition to the last interceptor who
|
||||
* returned {@code false}.
|
||||
* interceptors whose handleRequest invocation returned {@code true}, in addition to the last interceptor who returned
|
||||
* {@code false}.
|
||||
*
|
||||
* @param mappedEndpoint the mapped EndpointInvocationChain
|
||||
* @param mappedEndpoint the mapped EndpointInvocationChain
|
||||
* @param interceptorIndex index of last interceptor that was called
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @param messageContext the message context, whose request and response are filled
|
||||
* @see EndpointInterceptor#handleResponse(MessageContext,Object)
|
||||
* @see EndpointInterceptor#handleFault(MessageContext, Object)
|
||||
*/
|
||||
private void triggerHandleResponse(EndpointInvocationChain mappedEndpoint,
|
||||
int interceptorIndex,
|
||||
MessageContext messageContext) throws Exception {
|
||||
if (mappedEndpoint != null && messageContext.hasResponse() &&
|
||||
!ObjectUtils.isEmpty(mappedEndpoint.getInterceptors())) {
|
||||
private void triggerHandleResponse(EndpointInvocationChain mappedEndpoint, int interceptorIndex,
|
||||
MessageContext messageContext) throws Exception {
|
||||
if (mappedEndpoint != null && messageContext.hasResponse()
|
||||
&& !ObjectUtils.isEmpty(mappedEndpoint.getInterceptors())) {
|
||||
boolean hasFault = false;
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
if (response instanceof FaultAwareWebServiceMessage) {
|
||||
@@ -369,8 +356,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
EndpointInterceptor interceptor = mappedEndpoint.getInterceptors()[i];
|
||||
if (!hasFault) {
|
||||
resume = interceptor.handleResponse(messageContext, mappedEndpoint.getEndpoint());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
resume = interceptor.handleFault(messageContext, mappedEndpoint.getEndpoint());
|
||||
}
|
||||
}
|
||||
@@ -378,20 +364,17 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger afterCompletion callbacks on the mapped EndpointInterceptors.
|
||||
* Will just invoke afterCompletion for all interceptors whose handleRequest invocation
|
||||
* has successfully completed and returned true, in addition to the last interceptor who
|
||||
* returned {@code false}.
|
||||
* Trigger afterCompletion callbacks on the mapped EndpointInterceptors. Will just invoke afterCompletion for all
|
||||
* interceptors whose handleRequest invocation has successfully completed and returned true, in addition to the last
|
||||
* interceptor who returned {@code false}.
|
||||
*
|
||||
* @param mappedEndpoint the mapped EndpointInvocationChain
|
||||
* @param mappedEndpoint the mapped EndpointInvocationChain
|
||||
* @param interceptorIndex index of last interceptor that successfully completed
|
||||
* @param ex Exception thrown on handler execution, or {@code null} if none
|
||||
* @see EndpointInterceptor#afterCompletion
|
||||
*/
|
||||
private void triggerAfterCompletion(EndpointInvocationChain mappedEndpoint,
|
||||
int interceptorIndex,
|
||||
MessageContext messageContext,
|
||||
Exception ex) throws Exception {
|
||||
private void triggerAfterCompletion(EndpointInvocationChain mappedEndpoint, int interceptorIndex,
|
||||
MessageContext messageContext, Exception ex) throws Exception {
|
||||
|
||||
// Apply afterCompletion methods of registered interceptors.
|
||||
if (mappedEndpoint != null) {
|
||||
@@ -401,8 +384,7 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
EndpointInterceptor interceptor = interceptors[i];
|
||||
try {
|
||||
interceptor.afterCompletion(messageContext, mappedEndpoint.getEndpoint(), ex);
|
||||
}
|
||||
catch (Throwable ex2) {
|
||||
} catch (Throwable ex2) {
|
||||
logger.error("EndpointInterceptor.afterCompletion threw exception", ex2);
|
||||
}
|
||||
}
|
||||
@@ -410,24 +392,21 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the {@code EndpointAdapters} used by this class. If no adapter beans are explicitly set by using
|
||||
* the {@code endpointAdapters} property, we use the default strategies.
|
||||
* Initialize the {@code EndpointAdapters} used by this class. If no adapter beans are explicitly set by using the
|
||||
* {@code endpointAdapters} property, we use the default strategies.
|
||||
*
|
||||
* @see #setEndpointAdapters(java.util.List)
|
||||
*/
|
||||
private void initEndpointAdapters(ApplicationContext applicationContext) throws BeansException {
|
||||
if (endpointAdapters == null) {
|
||||
Map<String, EndpointAdapter> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(applicationContext, EndpointAdapter.class, true, false);
|
||||
Map<String, EndpointAdapter> matchingBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,
|
||||
EndpointAdapter.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointAdapters = new ArrayList<EndpointAdapter>(matchingBeans.values());
|
||||
Collections.sort(endpointAdapters, new OrderComparator());
|
||||
}
|
||||
else {
|
||||
endpointAdapters =
|
||||
defaultStrategiesHelper.getDefaultStrategies(EndpointAdapter.class, applicationContext);
|
||||
} else {
|
||||
endpointAdapters = defaultStrategiesHelper.getDefaultStrategies(EndpointAdapter.class, applicationContext);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No EndpointAdapters found, using defaults");
|
||||
}
|
||||
@@ -436,8 +415,8 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the {@code EndpointExceptionResolver} used by this class. If no resolver beans are explicitly set
|
||||
* by using the {@code endpointExceptionResolvers} property, we use the default strategies.
|
||||
* Initialize the {@code EndpointExceptionResolver} used by this class. If no resolver beans are explicitly set by
|
||||
* using the {@code endpointExceptionResolvers} property, we use the default strategies.
|
||||
*
|
||||
* @see #setEndpointExceptionResolvers(java.util.List)
|
||||
*/
|
||||
@@ -448,10 +427,9 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointExceptionResolvers = new ArrayList<EndpointExceptionResolver>(matchingBeans.values());
|
||||
Collections.sort(endpointExceptionResolvers, new OrderComparator());
|
||||
}
|
||||
else {
|
||||
endpointExceptionResolvers = defaultStrategiesHelper
|
||||
.getDefaultStrategies(EndpointExceptionResolver.class, applicationContext);
|
||||
} else {
|
||||
endpointExceptionResolvers = defaultStrategiesHelper.getDefaultStrategies(EndpointExceptionResolver.class,
|
||||
applicationContext);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No EndpointExceptionResolvers found, using defaults");
|
||||
}
|
||||
@@ -460,22 +438,20 @@ public class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAwa
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the {@code EndpointMappings} used by this class. If no mapping beans are explictely set by using
|
||||
* the {@code endpointMappings} property, we use the default strategies.
|
||||
* Initialize the {@code EndpointMappings} used by this class. If no mapping beans are explictely set by using the
|
||||
* {@code endpointMappings} property, we use the default strategies.
|
||||
*
|
||||
* @see #setEndpointMappings(java.util.List)
|
||||
*/
|
||||
private void initEndpointMappings(ApplicationContext applicationContext) throws BeansException {
|
||||
if (endpointMappings == null) {
|
||||
Map<String, EndpointMapping> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(applicationContext, EndpointMapping.class, true, false);
|
||||
Map<String, EndpointMapping> matchingBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,
|
||||
EndpointMapping.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
endpointMappings = new ArrayList<EndpointMapping>(matchingBeans.values());
|
||||
Collections.sort(endpointMappings, new OrderComparator());
|
||||
}
|
||||
else {
|
||||
endpointMappings =
|
||||
defaultStrategiesHelper.getDefaultStrategies(EndpointMapping.class, applicationContext);
|
||||
} else {
|
||||
endpointMappings = defaultStrategiesHelper.getDefaultStrategies(EndpointMapping.class, applicationContext);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No EndpointMappings found, using defaults");
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@ package org.springframework.ws.server;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Extension of the {@link EndpointInterceptor} interface that adds a way to
|
||||
* decide whether the interceptor should intercept a given message context.
|
||||
* Extension of the {@link EndpointInterceptor} interface that adds a way to decide whether the interceptor should
|
||||
* intercept a given message context.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -30,7 +31,7 @@ public interface SmartEndpointInterceptor extends EndpointInterceptor {
|
||||
* Indicates whether this interceptor should intercept the given message context.
|
||||
*
|
||||
* @param messageContext contains the incoming request message
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @param endpoint chosen endpoint to invoke
|
||||
* @return {@code true} to indicate that this interceptor applies; {@code false} otherwise
|
||||
*/
|
||||
boolean shouldIntercept(MessageContext messageContext, Object endpoint);
|
||||
|
||||
@@ -26,15 +26,14 @@ import org.dom4j.Element;
|
||||
import org.dom4j.io.DOMReader;
|
||||
import org.dom4j.io.DocumentResult;
|
||||
import org.dom4j.io.DocumentSource;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload as dom4j elements. Offers the message payload as a
|
||||
* dom4j {@code Element}, and allows subclasses to create a response by returning an {@code Element}.
|
||||
*
|
||||
* <p>An {@code AbstractDom4JPayloadEndpoint} only accept one payload element. Multiple payload elements are not in
|
||||
* <p>
|
||||
* An {@code AbstractDom4JPayloadEndpoint} only accept one payload element. Multiple payload elements are not in
|
||||
* accordance with WS-I.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -49,8 +48,8 @@ public abstract class AbstractDom4jPayloadEndpoint extends TransformerObjectSupp
|
||||
|
||||
/**
|
||||
* Set if the request {@link Source} should always be transformed into a new {@link DocumentResult}.
|
||||
*
|
||||
* <p>Default is {@code false}, which is faster.
|
||||
* <p>
|
||||
* Default is {@code false}, which is faster.
|
||||
*/
|
||||
public void setAlwaysTransform(boolean alwaysTransform) {
|
||||
this.alwaysTransform = alwaysTransform;
|
||||
@@ -71,8 +70,8 @@ public abstract class AbstractDom4jPayloadEndpoint extends TransformerObjectSupp
|
||||
|
||||
/**
|
||||
* Returns the payload element of the given source.
|
||||
*
|
||||
* <p>Default implementation checks whether the source is a {@link javax.xml.transform.dom.DOMSource}, and uses a
|
||||
* <p>
|
||||
* Default implementation checks whether the source is a {@link javax.xml.transform.dom.DOMSource}, and uses a
|
||||
* {@link org.dom4j.io.DOMReader} to create a JDOM {@link org.dom4j.Element}. In all other cases, or when
|
||||
* {@linkplain #setAlwaysTransform(boolean) alwaysTransform} is {@code true}, the source is transformed into a
|
||||
* {@link org.dom4j.io.DocumentResult}, which is more expensive. If the passed source is {@code null}, {@code
|
||||
@@ -80,8 +79,7 @@ public abstract class AbstractDom4jPayloadEndpoint extends TransformerObjectSupp
|
||||
*
|
||||
* @param source the source to return the root element of; can be {@code null}
|
||||
* @return the document element
|
||||
* @throws javax.xml.transform.TransformerException
|
||||
* in case of errors
|
||||
* @throws javax.xml.transform.TransformerException in case of errors
|
||||
*/
|
||||
protected Element getDocumentElement(Source source) throws TransformerException {
|
||||
if (source == null) {
|
||||
@@ -102,13 +100,12 @@ public abstract class AbstractDom4jPayloadEndpoint extends TransformerObjectSupp
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a dom4j {@code Element}, and
|
||||
* allows subclasses to return a response {@code Element}.
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a dom4j {@code Element}, and allows
|
||||
* subclasses to return a response {@code Element}.
|
||||
* <p>
|
||||
* The given dom4j {@code Document} is to be used for constructing a response element, by using {@code addElement}.
|
||||
*
|
||||
* <p>The given dom4j {@code Document} is to be used for constructing a response element, by using
|
||||
* {@code addElement}.
|
||||
*
|
||||
* @param requestElement the contents of the SOAP message as dom4j elements
|
||||
* @param requestElement the contents of the SOAP message as dom4j elements
|
||||
* @param responseDocument a dom4j document to be used for constructing a response
|
||||
* @return the response element. Can be {@code null} to specify no response.
|
||||
*/
|
||||
|
||||
@@ -24,21 +24,20 @@ import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.springframework.xml.DocumentBuilderFactoryUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.springframework.xml.DocumentBuilderFactoryUtils;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload as DOM elements.
|
||||
*
|
||||
* <p>Offers the message payload as a DOM {@code Element}, and allows subclasses to create a response by returning an
|
||||
* <p>
|
||||
* Offers the message payload as a DOM {@code Element}, and allows subclasses to create a response by returning an
|
||||
* {@code Element}.
|
||||
*
|
||||
* <p>An {@code AbstractDomPayloadEndpoint} only accept <em>one</em> payload element. Multiple payload elements are
|
||||
* not in accordance with WS-I.
|
||||
* <p>
|
||||
* An {@code AbstractDomPayloadEndpoint} only accept <em>one</em> payload element. Multiple payload elements are not in
|
||||
* accordance with WS-I.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Alef Arendsen
|
||||
@@ -70,18 +69,16 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the XML parser should expand entity reference nodes. Default is
|
||||
* {@code false}.
|
||||
* Set if the XML parser should expand entity reference nodes. Default is {@code false}.
|
||||
*/
|
||||
public void setExpandEntityReferences(boolean expandEntityRef) {
|
||||
documentBuilderFactory.setExpandEntityReferences(expandEntityRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set if the request {@link Source} should always be transformed into a new {@link DOMResult}.
|
||||
*
|
||||
* <p>Default is {@code false}, which is faster.
|
||||
* <p>
|
||||
* Default is {@code false}, which is faster.
|
||||
*/
|
||||
public void setAlwaysTransform(boolean alwaysTransform) {
|
||||
this.alwaysTransform = alwaysTransform;
|
||||
@@ -107,8 +104,7 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
|
||||
* @return the {@code DocumentBuilder}
|
||||
* @throws ParserConfigurationException if thrown by JAXP methods
|
||||
*/
|
||||
protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory)
|
||||
throws ParserConfigurationException {
|
||||
protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory) throws ParserConfigurationException {
|
||||
return factory.newDocumentBuilder();
|
||||
}
|
||||
|
||||
@@ -130,13 +126,13 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
|
||||
|
||||
/**
|
||||
* Returns the payload element of the given source.
|
||||
*
|
||||
* <p>Default implementation checks whether the source is a {@link DOMSource}, and returns the {@linkplain
|
||||
* DOMSource#getNode() node} of that. In all other cases, or when {@linkplain #setAlwaysTransform(boolean)
|
||||
* <p>
|
||||
* Default implementation checks whether the source is a {@link DOMSource}, and returns the
|
||||
* {@linkplain DOMSource#getNode() node} of that. In all other cases, or when {@linkplain #setAlwaysTransform(boolean)
|
||||
* alwaysTransform} is {@code true}, the source is transformed into a {@link DOMResult}, which is more expensive. If
|
||||
* the passed source is {@code null}, {@code null} is returned.
|
||||
*
|
||||
* @param source the source to return the root element of; can be {@code null}
|
||||
* @param source the source to return the root element of; can be {@code null}
|
||||
* @param documentBuilder the document builder to be used for transformations
|
||||
* @return the document element
|
||||
* @throws TransformerException in case of errors
|
||||
@@ -149,8 +145,7 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
|
||||
Node node = ((DOMSource) source).getNode();
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
return (Element) node;
|
||||
}
|
||||
else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
} else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
return ((Document) node).getDocumentElement();
|
||||
}
|
||||
}
|
||||
@@ -163,14 +158,13 @@ public abstract class AbstractDomPayloadEndpoint extends TransformerObjectSuppor
|
||||
|
||||
/**
|
||||
* Template method that subclasses must implement to process the request.
|
||||
* <p>
|
||||
* Offers the request payload as a DOM {@code Element}, and allows subclasses to return a response {@code Element}.
|
||||
* <p>
|
||||
* The given DOM {@code Document} is to be used for constructing {@code Node}s, by using the various {@code create}
|
||||
* methods.
|
||||
*
|
||||
* <p>Offers the request payload as a DOM {@code Element}, and allows subclasses to return a response
|
||||
* {@code Element}.
|
||||
*
|
||||
* <p>The given DOM {@code Document} is to be used for constructing {@code Node}s, by using the various
|
||||
* {@code create} methods.
|
||||
*
|
||||
* @param requestElement the contents of the SOAP message as DOM elements
|
||||
* @param requestElement the contents of the SOAP message as DOM elements
|
||||
* @param responseDocument a DOM document to be used for constructing {@code Node}s
|
||||
* @return the response element. Can be {@code null} to specify no response.
|
||||
*/
|
||||
|
||||
@@ -20,15 +20,14 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.server.EndpointExceptionResolver;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link EndpointExceptionResolver EndpointExceptionResolvers}.
|
||||
*
|
||||
* <p>Provides a set of mapped endpoints that the resolver should map.
|
||||
* <p>
|
||||
* Provides a set of mapped endpoints that the resolver should map.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Tareq Abed Rabbo
|
||||
@@ -39,17 +38,18 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
/** Shared {@link Log} for subclasses to use. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
|
||||
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
|
||||
|
||||
private Set<?> mappedEndpoints;
|
||||
|
||||
private Log warnLogger;
|
||||
|
||||
/**
|
||||
* Specify the set of endpoints that this exception resolver should map. <p>The exception mappings and the default
|
||||
* fault will only apply to the specified endpoints.
|
||||
*
|
||||
* <p>If no endpoints are set, both the exception mappings and the default fault will apply to all handlers. This means
|
||||
* Specify the set of endpoints that this exception resolver should map.
|
||||
* <p>
|
||||
* The exception mappings and the default fault will only apply to the specified endpoints.
|
||||
* <p>
|
||||
* If no endpoints are set, both the exception mappings and the default fault will apply to all handlers. This means
|
||||
* that a specified default fault will be used as fallback for all exceptions; any further
|
||||
* {@code EndpointExceptionResolvers} in the chain will be ignored in this case.
|
||||
*/
|
||||
@@ -60,9 +60,9 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
/**
|
||||
* Set the log category for warn logging. The name will be passed to the underlying logger implementation through
|
||||
* Commons Logging, getting interpreted as log category according to the logger's configuration.
|
||||
*
|
||||
* <p>Default is no warn logging. Specify this setting to activate warn logging into a specific category.
|
||||
* Alternatively, override the {@link #logException} method for custom logging.
|
||||
* <p>
|
||||
* Default is no warn logging. Specify this setting to activate warn logging into a specific category. Alternatively,
|
||||
* override the {@link #logException} method for custom logging.
|
||||
*
|
||||
* @see org.apache.commons.logging.LogFactory#getLog(String)
|
||||
* @see org.apache.log4j.Logger#getLogger(String)
|
||||
@@ -74,8 +74,8 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
|
||||
/**
|
||||
* Specify the order value for this mapping.
|
||||
*
|
||||
* <p>Default value is {@link Integer#MAX_VALUE}, meaning that it's non-ordered.
|
||||
* <p>
|
||||
* Default value is {@link Integer#MAX_VALUE}, meaning that it's non-ordered.
|
||||
*
|
||||
* @see org.springframework.core.Ordered#getOrder()
|
||||
*/
|
||||
@@ -89,8 +89,8 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation that checks whether the given {@code endpoint} is in the set of {@link
|
||||
* #setMappedEndpoints mapped endpoints}.
|
||||
* Default implementation that checks whether the given {@code endpoint} is in the set of {@link #setMappedEndpoints
|
||||
* mapped endpoints}.
|
||||
*
|
||||
* @see #resolveExceptionInternal(MessageContext,Object,Exception)
|
||||
*/
|
||||
@@ -109,13 +109,13 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the given exception at warn level, provided that warn logging has been activated through the {@link
|
||||
* #setWarnLogCategory "warnLogCategory"} property.
|
||||
* Log the given exception at warn level, provided that warn logging has been activated through the
|
||||
* {@link #setWarnLogCategory "warnLogCategory"} property.
|
||||
* <p>
|
||||
* Calls {@link #buildLogMessage} in order to determine the concrete message to log. Always passes the full exception
|
||||
* to the logger.
|
||||
*
|
||||
* <p>Calls {@link #buildLogMessage} in order to determine the concrete message to log. Always passes the full
|
||||
* exception to the logger.
|
||||
*
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @param messageContext current message context request
|
||||
* @see #setWarnLogCategory
|
||||
* @see #buildLogMessage
|
||||
@@ -130,7 +130,7 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
/**
|
||||
* Build a log message for the given exception, occured during processing the given message context.
|
||||
*
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @param ex the exception that got thrown during handler execution
|
||||
* @param messageContext the message context
|
||||
* @return the log message to use
|
||||
*/
|
||||
@@ -142,8 +142,8 @@ public abstract class AbstractEndpointExceptionResolver implements EndpointExcep
|
||||
* Template method for resolving exceptions that is called by {@link #resolveException}.
|
||||
*
|
||||
* @param messageContext current message context
|
||||
* @param endpoint the executed endpoint, or {@code null} if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during endpoint execution
|
||||
* @param endpoint the executed endpoint, or {@code null} if none chosen at the time of the exception
|
||||
* @param ex the exception that got thrown during endpoint execution
|
||||
* @return {@code true} if resolved; {@code false} otherwise
|
||||
* @see #resolveException(MessageContext,Object,Exception)
|
||||
*/
|
||||
|
||||
@@ -25,18 +25,15 @@ import org.jdom2.Element;
|
||||
import org.jdom2.input.DOMBuilder;
|
||||
import org.jdom2.transform.JDOMResult;
|
||||
import org.jdom2.transform.JDOMSource;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload as JDOM elements.
|
||||
*
|
||||
* <p>Offers the message payload as a JDOM {@link Element}, and allows subclasses to create a response by returning an
|
||||
* {@code Element}.
|
||||
*
|
||||
* <pAn {@code AbstractJDomPayloadEndpoint} can accept only <i>one</i> payload element. Multiple payload elements
|
||||
* are not in accordance with WS-I.
|
||||
* <p>
|
||||
* Offers the message payload as a JDOM {@link Element}, and allows subclasses to create a response by returning an
|
||||
* {@code Element}. <pAn {@code AbstractJDomPayloadEndpoint} can accept only <i>one</i> payload element. Multiple
|
||||
* payload elements are not in accordance with WS-I.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
@@ -49,8 +46,8 @@ public abstract class AbstractJDomPayloadEndpoint extends TransformerObjectSuppo
|
||||
|
||||
/**
|
||||
* Set if the request {@link Source} should always be transformed into a new {@link JDOMResult}.
|
||||
*
|
||||
* <p>Default is {@code false}, which is faster.
|
||||
* <p>
|
||||
* Default is {@code false}, which is faster.
|
||||
*/
|
||||
public void setAlwaysTransform(boolean alwaysTransform) {
|
||||
this.alwaysTransform = alwaysTransform;
|
||||
@@ -65,11 +62,11 @@ public abstract class AbstractJDomPayloadEndpoint extends TransformerObjectSuppo
|
||||
|
||||
/**
|
||||
* Returns the payload element of the given source.
|
||||
*
|
||||
* <p>Default implementation checks whether the source is a {@link DOMSource}, and uses a {@link DOMBuilder} to create
|
||||
* a JDOM {@link Element}. In all other cases, or when {@linkplain #setAlwaysTransform(boolean) alwaysTransform} is
|
||||
* {@code true}, the source is transformed into a {@link JDOMResult}, which is more expensive. If the passed source
|
||||
* is {@code null}, {@code null} is returned.
|
||||
* <p>
|
||||
* Default implementation checks whether the source is a {@link DOMSource}, and uses a {@link DOMBuilder} to create a
|
||||
* JDOM {@link Element}. In all other cases, or when {@linkplain #setAlwaysTransform(boolean) alwaysTransform} is
|
||||
* {@code true}, the source is transformed into a {@link JDOMResult}, which is more expensive. If the passed source is
|
||||
* {@code null}, {@code null} is returned.
|
||||
*
|
||||
* @param source the source to return the root element of; can be {@code null}
|
||||
* @return the document element
|
||||
@@ -84,8 +81,7 @@ public abstract class AbstractJDomPayloadEndpoint extends TransformerObjectSuppo
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
return domBuilder.build((org.w3c.dom.Element) node);
|
||||
}
|
||||
else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
} else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
Document document = domBuilder.build((org.w3c.dom.Document) node);
|
||||
return document.getRootElement();
|
||||
}
|
||||
@@ -97,8 +93,8 @@ public abstract class AbstractJDomPayloadEndpoint extends TransformerObjectSuppo
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a JDOM {@code Element}, and
|
||||
* allows subclasses to return a response {@code Element}.
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a JDOM {@code Element}, and allows
|
||||
* subclasses to return a response {@code Element}.
|
||||
*
|
||||
* @param requestElement the contents of the SOAP message as JDOM element
|
||||
* @return the response element. Can be {@code null} to specify no response.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.ws.server.endpoint;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
@@ -26,16 +27,15 @@ import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.server.EndpointInterceptor;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@code EndpointInterceptor} instances that log a part of a
|
||||
* {@code WebServiceMessage}. By default, both request and response messages are logged, but this behaviour can be
|
||||
* changed using the {@code logRequest} and {@code logResponse} properties.
|
||||
* Abstract base class for {@code EndpointInterceptor} instances that log a part of a {@code WebServiceMessage}. By
|
||||
* default, both request and response messages are logged, but this behaviour can be changed using the
|
||||
* {@code logRequest} and {@code logResponse} properties.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
@@ -63,10 +63,10 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the logger to use. The name will be passed to the underlying logger implementation through
|
||||
* Commons Logging, getting interpreted as log category according to the logger's configuration.
|
||||
*
|
||||
* <p>This can be specified to not log into the category of a class but rather into a specific named category.
|
||||
* Set the name of the logger to use. The name will be passed to the underlying logger implementation through Commons
|
||||
* Logging, getting interpreted as log category according to the logger's configuration.
|
||||
* <p>
|
||||
* This can be specified to not log into the category of a class but rather into a specific named category.
|
||||
*
|
||||
* @see org.apache.commons.logging.LogFactory#getLog(String)
|
||||
* @see org.apache.log4j.Logger#getLogger(String)
|
||||
@@ -77,8 +77,8 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the request message payload. Logging only occurs if {@code logRequest} is set to {@code true},
|
||||
* which is the default.
|
||||
* Logs the request message payload. Logging only occurs if {@code logRequest} is set to {@code true}, which is the
|
||||
* default.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @return {@code true}
|
||||
@@ -93,8 +93,8 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the response message payload. Logging only occurs if {@code logResponse} is set to {@code true},
|
||||
* which is the default.
|
||||
* Logs the response message payload. Logging only occurs if {@code logResponse} is set to {@code true}, which is the
|
||||
* default.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @return {@code true}
|
||||
@@ -114,16 +114,15 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Does nothing by default*/
|
||||
/** Does nothing by default */
|
||||
@Override
|
||||
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
|
||||
}
|
||||
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {}
|
||||
|
||||
/**
|
||||
* Determine whether the {@link #logger} field is enabled.
|
||||
*
|
||||
* <p>Default is {@code true} when the "debug" level is enabled. Subclasses can override this to change the level
|
||||
* under which logging occurs.
|
||||
* <p>
|
||||
* Default is {@code true} when the "debug" level is enabled. Subclasses can override this to change the level under
|
||||
* which logging occurs.
|
||||
*/
|
||||
protected boolean isLogEnabled() {
|
||||
return logger.isDebugEnabled();
|
||||
@@ -138,12 +137,12 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
|
||||
/**
|
||||
* Logs the given {@link Source source} to the {@link #logger}, using the message as a prefix.
|
||||
*
|
||||
* <p>By default, this message creates a string representation of the given source, and delegates to {@link
|
||||
* #logMessage(String)}.
|
||||
* <p>
|
||||
* By default, this message creates a string representation of the given source, and delegates to
|
||||
* {@link #logMessage(String)}.
|
||||
*
|
||||
* @param logMessage the log message
|
||||
* @param source the source to be logged
|
||||
* @param source the source to be logged
|
||||
* @throws TransformerException in case of errors
|
||||
*/
|
||||
protected void logMessageSource(String logMessage, Source source) throws TransformerException {
|
||||
@@ -158,9 +157,9 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
|
||||
/**
|
||||
* Logs the given string message.
|
||||
*
|
||||
* <p>By default, this method uses a "debug" level of logging. Subclasses can override this method to change the level
|
||||
* of logging used by the logger.
|
||||
* <p>
|
||||
* By default, this method uses a "debug" level of logging. Subclasses can override this method to change the level of
|
||||
* logging used by the logger.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
@@ -31,8 +30,8 @@ import org.springframework.ws.support.MarshallingUtils;
|
||||
|
||||
/**
|
||||
* Endpoint that unmarshals the request payload, and marshals the response object. This endpoint needs a
|
||||
* {@code Marshaller} and {@code Unmarshaller}, both of which can be set using properties. An abstract
|
||||
* template method is invoked using the request object as a parameter, and allows for a response object to be returned.
|
||||
* {@code Marshaller} and {@code Unmarshaller}, both of which can be set using properties. An abstract template method
|
||||
* is invoked using the request object as a parameter, and allows for a response object to be returned.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see #setMarshaller(org.springframework.oxm.Marshaller)
|
||||
@@ -54,36 +53,33 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
|
||||
private Unmarshaller unmarshaller;
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractMarshallingPayloadEndpoint}. The {@link Marshaller} and {@link Unmarshaller}
|
||||
* must be injected using properties.
|
||||
* Creates a new {@code AbstractMarshallingPayloadEndpoint}. The {@link Marshaller} and {@link Unmarshaller} must be
|
||||
* injected using properties.
|
||||
*
|
||||
* @see #setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see #setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
*/
|
||||
protected AbstractMarshallingPayloadEndpoint() {
|
||||
}
|
||||
protected AbstractMarshallingPayloadEndpoint() {}
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractMarshallingPayloadEndpoint} with the given marshaller. The given {@link
|
||||
* Marshaller} should also implements the {@link Unmarshaller}, since it is used for both marshalling and
|
||||
* unmarshalling. If it is not, an exception is thrown.
|
||||
*
|
||||
* <p>Note that all {@link Marshaller} implementations in Spring-WS also implement the {@link Unmarshaller} interface,
|
||||
* so that you can safely use this constructor.
|
||||
* Creates a new {@code AbstractMarshallingPayloadEndpoint} with the given marshaller. The given {@link Marshaller}
|
||||
* should also implements the {@link Unmarshaller}, since it is used for both marshalling and unmarshalling. If it is
|
||||
* not, an exception is thrown.
|
||||
* <p>
|
||||
* Note that all {@link Marshaller} implementations in Spring-WS also implement the {@link Unmarshaller} interface, so
|
||||
* that you can safely use this constructor.
|
||||
*
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller}
|
||||
* interface
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller} interface
|
||||
* @see #AbstractMarshallingPayloadEndpoint(Marshaller,Unmarshaller)
|
||||
*/
|
||||
protected AbstractMarshallingPayloadEndpoint(Marshaller marshaller) {
|
||||
Assert.notNull(marshaller, "marshaller must not be null");
|
||||
if (!(marshaller instanceof Unmarshaller)) {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller " +
|
||||
"interface. Please set an Unmarshaller explicitly by using the " +
|
||||
"AbstractMarshallingPayloadEndpoint(Marshaller, Unmarshaller) constructor.");
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller "
|
||||
+ "interface. Please set an Unmarshaller explicitly by using the "
|
||||
+ "AbstractMarshallingPayloadEndpoint(Marshaller, Unmarshaller) constructor.");
|
||||
} else {
|
||||
setMarshaller(marshaller);
|
||||
setUnmarshaller((Unmarshaller) marshaller);
|
||||
}
|
||||
@@ -92,7 +88,7 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
|
||||
/**
|
||||
* Creates a new {@code AbstractMarshallingPayloadEndpoint} with the given marshaller and unmarshaller.
|
||||
*
|
||||
* @param marshaller the marshaller to use
|
||||
* @param marshaller the marshaller to use
|
||||
* @param unmarshaller the unmarshaller to use
|
||||
*/
|
||||
protected AbstractMarshallingPayloadEndpoint(Marshaller marshaller, Unmarshaller unmarshaller) {
|
||||
@@ -154,11 +150,11 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
|
||||
/**
|
||||
* Callback for post-processing in terms of unmarshalling. Called on each message request, after standard
|
||||
* unmarshalling.
|
||||
*
|
||||
* <p>Default implementation returns {@code true}.
|
||||
* <p>
|
||||
* Default implementation returns {@code true}.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @return {@code true} to continue and call {@link #invokeInternal(Object)}; {@code false} otherwise
|
||||
*/
|
||||
protected boolean onUnmarshalRequest(MessageContext messageContext, Object requestObject) throws Exception {
|
||||
@@ -175,34 +171,32 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for post-processing in terms of marshalling. Called on each message request, after standard marshalling
|
||||
* of the response. Only invoked when {@link #invokeInternal(Object)} returns an object.
|
||||
*
|
||||
* <p>Default implementation is empty.
|
||||
* Callback for post-processing in terms of marshalling. Called on each message request, after standard marshalling of
|
||||
* the response. Only invoked when {@link #invokeInternal(Object)} returns an object.
|
||||
* <p>
|
||||
* Default implementation is empty.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @param responseObject the object marshalled to the {@link MessageContext#getResponse()} request}
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @param responseObject the object marshalled to the {@link MessageContext#getResponse()} request}
|
||||
*/
|
||||
protected void onMarshalResponse(MessageContext messageContext, Object requestObject, Object responseObject) {
|
||||
}
|
||||
protected void onMarshalResponse(MessageContext messageContext, Object requestObject, Object responseObject) {}
|
||||
|
||||
/**
|
||||
* Template method that gets called after the marshaller and unmarshaller have been set.
|
||||
* <p>
|
||||
* The default implementation does nothing.
|
||||
*
|
||||
* <p>The default implementation does nothing.
|
||||
*
|
||||
* @deprecated as of Spring Web Services 1.5: {@link #afterPropertiesSet()} is no longer final, so this can safely
|
||||
* be overridden in subclasses
|
||||
* @deprecated as of Spring Web Services 1.5: {@link #afterPropertiesSet()} is no longer final, so this can safely be
|
||||
* overridden in subclasses
|
||||
*/
|
||||
@Deprecated
|
||||
public void afterMarshallerSet() throws Exception {
|
||||
}
|
||||
public void afterMarshallerSet() throws Exception {}
|
||||
|
||||
/**
|
||||
* Template method that subclasses must implement to process a request.
|
||||
*
|
||||
* <p>The unmarshalled request object is passed as a parameter, and the returned object is marshalled to a response. If
|
||||
* <p>
|
||||
* The unmarshalled request object is passed as a parameter, and the returned object is marshalled to a response. If
|
||||
* no response is required, return {@code null}.
|
||||
*
|
||||
* @param requestObject the unmarshalled message payload as an object
|
||||
|
||||
@@ -19,16 +19,15 @@ package org.springframework.ws.server.endpoint;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
|
||||
import org.xml.sax.ContentHandler;
|
||||
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.xml.sax.ContentHandler;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload with a SAX {@code ContentHandler}. Allows
|
||||
* subclasses to create a response by returning a {@code Source}.
|
||||
*
|
||||
* <p>Implementations of this class should create a new handler for each call of {@code createContentHandler}, because
|
||||
* of thread safety. The handlers is later passed on to {@code createResponse}, so it can be used for holding
|
||||
* <p>
|
||||
* Implementations of this class should create a new handler for each call of {@code createContentHandler}, because of
|
||||
* thread safety. The handlers is later passed on to {@code createResponse}, so it can be used for holding
|
||||
* request-specific state.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -59,21 +58,21 @@ public abstract class AbstractSaxPayloadEndpoint extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SAX {@code ContentHandler} used to parse the incoming request payload. A new instance should be
|
||||
* created for each call, because of thread-safety. The content handler can be used to hold request-specific state.
|
||||
*
|
||||
* <p>If an incoming message does not contain a payload, this method will not be invoked.
|
||||
* Returns the SAX {@code ContentHandler} used to parse the incoming request payload. A new instance should be created
|
||||
* for each call, because of thread-safety. The content handler can be used to hold request-specific state.
|
||||
* <p>
|
||||
* If an incoming message does not contain a payload, this method will not be invoked.
|
||||
*
|
||||
* @return a SAX content handler to be used for parsing
|
||||
*/
|
||||
protected abstract ContentHandler createContentHandler() throws Exception;
|
||||
|
||||
/**
|
||||
* Returns the response to be given, if any. This method is called after the request payload has been parsed using
|
||||
* the SAX {@code ContentHandler}. The passed {@code ContentHandler} is created by {@link
|
||||
* #createContentHandler()}: it can be used to hold request-specific state.
|
||||
*
|
||||
* <p>If an incoming message does not contain a payload, this method will be invoked with {@code null} as content
|
||||
* Returns the response to be given, if any. This method is called after the request payload has been parsed using the
|
||||
* SAX {@code ContentHandler}. The passed {@code ContentHandler} is created by {@link #createContentHandler()}: it can
|
||||
* be used to hold request-specific state.
|
||||
* <p>
|
||||
* If an incoming message does not contain a payload, this method will be invoked with {@code null} as content
|
||||
* handler.
|
||||
*
|
||||
* @param contentHandler the content handler used to parse the request
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.server.endpoint;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.stream.XMLEventFactory;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
@@ -42,7 +43,7 @@ import org.springframework.ws.context.MessageContext;
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see #invokeInternal(javax.xml.stream.XMLEventReader,javax.xml.stream.util.XMLEventConsumer,
|
||||
* javax.xml.stream.XMLEventFactory)
|
||||
* javax.xml.stream.XMLEventFactory)
|
||||
* @see XMLEventReader
|
||||
* @see XMLEventWriter
|
||||
* @since 1.0.0
|
||||
@@ -62,9 +63,9 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code XMLEventFactory} that this endpoint will use to create {@code XMLEvent}s. Can be
|
||||
* overridden in subclasses, adding further initialization of the factory. The resulting
|
||||
* {@code XMLEventFactory} is cached, so this method will only be called once.
|
||||
* Create a {@code XMLEventFactory} that this endpoint will use to create {@code XMLEvent}s. Can be overridden in
|
||||
* subclasses, adding further initialization of the factory. The resulting {@code XMLEventFactory} is cached, so this
|
||||
* method will only be called once.
|
||||
*
|
||||
* @return the created {@code XMLEventFactory}
|
||||
*/
|
||||
@@ -92,8 +93,7 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
if (streamReader != null) {
|
||||
try {
|
||||
eventReader = getInputFactory().createXMLEventReader(streamReader);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
}
|
||||
@@ -102,11 +102,9 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
if (eventReader == null) {
|
||||
try {
|
||||
eventReader = getInputFactory().createXMLEventReader(source);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
}
|
||||
@@ -128,8 +126,7 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
if (eventWriter == null) {
|
||||
try {
|
||||
eventWriter = getOutputFactory().createXMLEventWriter(result);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -137,20 +134,19 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a {@code XMLEventReader}, and
|
||||
* a {@code XMLEventWriter} to write the response payload to.
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a {@code XMLEventReader}, and a
|
||||
* {@code XMLEventWriter} to write the response payload to.
|
||||
*
|
||||
* @param eventReader the reader to read the payload events from
|
||||
* @param eventWriter the writer to write payload events to
|
||||
* @param eventReader the reader to read the payload events from
|
||||
* @param eventWriter the writer to write payload events to
|
||||
* @param eventFactory an {@code XMLEventFactory} that can be used to create events
|
||||
*/
|
||||
protected abstract void invokeInternal(XMLEventReader eventReader,
|
||||
XMLEventConsumer eventWriter,
|
||||
XMLEventFactory eventFactory) throws Exception;
|
||||
protected abstract void invokeInternal(XMLEventReader eventReader, XMLEventConsumer eventWriter,
|
||||
XMLEventFactory eventFactory) throws Exception;
|
||||
|
||||
/**
|
||||
* Implementation of the {@code XMLEventWriter} interface that creates a response
|
||||
* {@code WebServiceMessage} as soon as any method is called, thus lazily creating the response.
|
||||
* Implementation of the {@code XMLEventWriter} interface that creates a response {@code WebServiceMessage} as soon as
|
||||
* any method is called, thus lazily creating the response.
|
||||
*/
|
||||
private class ResponseCreatingEventWriter implements XMLEventWriter {
|
||||
|
||||
@@ -194,8 +190,7 @@ public abstract class AbstractStaxEventPayloadEndpoint extends AbstractStaxPaylo
|
||||
try {
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
|
||||
transform(new StreamSource(is), messageContext.getResponse().getPayloadResult());
|
||||
}
|
||||
catch (TransformerException ex) {
|
||||
} catch (TransformerException ex) {
|
||||
throw new XMLStreamException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.springframework.xml.XMLInputFactoryUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints use StAX. Provides an {@code XMLInputFactory} and an
|
||||
* {@code XMLOutputFactory}.
|
||||
* Abstract base class for endpoints use StAX. Provides an {@code XMLInputFactory} and an {@code XMLOutputFactory}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see XMLInputFactory
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.server.endpoint;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@@ -68,8 +69,7 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
if (eventReader != null) {
|
||||
try {
|
||||
streamReader = StaxUtils.createEventStreamReader(eventReader);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
}
|
||||
@@ -79,11 +79,9 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
if (streamReader == null) {
|
||||
try {
|
||||
streamReader = getInputFactory().createXMLStreamReader(source);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
}
|
||||
@@ -105,8 +103,7 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
if (streamWriter == null) {
|
||||
try {
|
||||
streamWriter = getOutputFactory().createXMLStreamWriter(result);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@@ -114,8 +111,8 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a {@code XMLStreamReader},
|
||||
* and a {@code XMLStreamWriter} to write the response payload to.
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a {@code XMLStreamReader}, and a
|
||||
* {@code XMLStreamWriter} to write the response payload to.
|
||||
*
|
||||
* @param streamReader the reader to read the payload from
|
||||
* @param streamWriter the writer to write the payload to
|
||||
@@ -123,8 +120,8 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
protected abstract void invokeInternal(XMLStreamReader streamReader, XMLStreamWriter streamWriter) throws Exception;
|
||||
|
||||
/**
|
||||
* Implementation of the {@code XMLStreamWriter} interface that creates a response
|
||||
* {@code WebServiceMessage} as soon as any method is called, thus lazily creating the response.
|
||||
* Implementation of the {@code XMLStreamWriter} interface that creates a response {@code WebServiceMessage} as soon
|
||||
* as any method is called, thus lazily creating the response.
|
||||
*/
|
||||
private class ResponseCreatingStreamWriter implements XMLStreamWriter {
|
||||
|
||||
@@ -160,8 +157,7 @@ public abstract class AbstractStaxStreamPayloadEndpoint extends AbstractStaxPayl
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
|
||||
transform(new StreamSource(is), messageContext.getResponse().getPayloadResult());
|
||||
os = null;
|
||||
}
|
||||
catch (TransformerException ex) {
|
||||
} catch (TransformerException ex) {
|
||||
throw new XMLStreamException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ import org.springframework.validation.Validator;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Extension of the {@link AbstractMarshallingPayloadEndpoint} which validates the request payload with {@link
|
||||
* Validator}(s). The desired validators can be set using properties, and <strong>must</strong> {@link
|
||||
* Validator#supports(Class) support} the request object.
|
||||
* Extension of the {@link AbstractMarshallingPayloadEndpoint} which validates the request payload with
|
||||
* {@link Validator}(s). The desired validators can be set using properties, and <strong>must</strong>
|
||||
* {@link Validator#supports(Class) support} the request object.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.2
|
||||
@@ -58,12 +58,12 @@ public abstract class AbstractValidatingMarshallingPayloadEndpoint extends Abstr
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the primary {@link Validator} for this endpoint. The {@link Validator} is must support the unmarshalled
|
||||
* class. If there are one or more existing validators set already when this method is called, only the specified
|
||||
* validator will be kept. Use {@link #setValidators(Validator[])} to set multiple validators.
|
||||
* Set the primary {@link Validator} for this endpoint. The {@link Validator} is must support the unmarshalled class.
|
||||
* If there are one or more existing validators set already when this method is called, only the specified validator
|
||||
* will be kept. Use {@link #setValidators(Validator[])} to set multiple validators.
|
||||
*/
|
||||
public void setValidator(Validator validator) {
|
||||
this.validators = new Validator[]{validator};
|
||||
this.validators = new Validator[] { validator };
|
||||
}
|
||||
|
||||
/** Return the Validators for this controller. */
|
||||
@@ -92,12 +92,11 @@ public abstract class AbstractValidatingMarshallingPayloadEndpoint extends Abstr
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for post-processing validation errors. Called when validator(s) have been specified, and validation
|
||||
* fails.
|
||||
* Callback for post-processing validation errors. Called when validator(s) have been specified, and validation fails.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @param errors validation errors holder
|
||||
* @param requestObject the object unmarshalled from the {@link MessageContext#getRequest() request}
|
||||
* @param errors validation errors holder
|
||||
* @return {@code true} to continue and call {@link #invokeInternal(Object)}; {@code false} otherwise
|
||||
*/
|
||||
protected abstract boolean onValidationErrors(MessageContext messageContext, Object requestObject, Errors errors);
|
||||
|
||||
@@ -16,20 +16,6 @@
|
||||
|
||||
package org.springframework.ws.server.endpoint;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.util.Locale;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import nu.xom.Attribute;
|
||||
import nu.xom.Builder;
|
||||
import nu.xom.Document;
|
||||
@@ -40,21 +26,36 @@ import nu.xom.ParsingException;
|
||||
import nu.xom.Serializer;
|
||||
import nu.xom.ValidityException;
|
||||
import nu.xom.converters.DOMConverter;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
import org.springframework.xml.transform.TraxUtils;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
/**
|
||||
* Abstract base class for endpoints that handle the message payload as XOM elements. Offers the message payload as a
|
||||
* XOM {@code Element}, and allows subclasses to create a response by returning an {@code Element}.
|
||||
*
|
||||
* <p>An {@code AbstractXomPayloadEndpoint} only accept one payload element. Multiple payload elements are not in
|
||||
* <p>
|
||||
* An {@code AbstractXomPayloadEndpoint} only accept one payload element. Multiple payload elements are not in
|
||||
* accordance with WS-I.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -73,8 +74,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
XomSourceCallback sourceCallback = new XomSourceCallback();
|
||||
try {
|
||||
TraxUtils.doWithSource(request, sourceCallback);
|
||||
}
|
||||
catch (XomParsingException ex) {
|
||||
} catch (XomParsingException ex) {
|
||||
throw (ParsingException) ex.getCause();
|
||||
}
|
||||
requestElement = sourceCallback.element;
|
||||
@@ -97,9 +97,8 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
|
||||
/**
|
||||
* Creates a {@link Serializer} to be used for writing the response to.
|
||||
*
|
||||
* <p>Default implementation uses the UTF-8 encoding and does not set any options, but this may be changed in
|
||||
* subclasses.
|
||||
* <p>
|
||||
* Default implementation uses the UTF-8 encoding and does not set any options, but this may be changed in subclasses.
|
||||
*
|
||||
* @param outputStream the output stream to serialize to
|
||||
* @return the serializer
|
||||
@@ -109,8 +108,8 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a XOM {@code Element}, and
|
||||
* allows subclasses to return a response {@code Element}.
|
||||
* Template method. Subclasses must implement this. Offers the request payload as a XOM {@code Element}, and allows
|
||||
* subclasses to return a response {@code Element}.
|
||||
*
|
||||
* @param requestElement the contents of the SOAP message as XOM element
|
||||
* @return the response element. Can be {@code null} to specify no response.
|
||||
@@ -125,12 +124,10 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
public void domSource(Node node) {
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
element = DOMConverter.convert((org.w3c.dom.Element) node);
|
||||
}
|
||||
else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
} else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
Document document = DOMConverter.convert((org.w3c.dom.Document) node);
|
||||
element = document.getRootElement();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException("DOMSource contains neither Document nor Element");
|
||||
}
|
||||
}
|
||||
@@ -142,20 +139,16 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
Document document;
|
||||
if (inputSource.getByteStream() != null) {
|
||||
document = builder.build(inputSource.getByteStream());
|
||||
}
|
||||
else if (inputSource.getCharacterStream() != null) {
|
||||
} else if (inputSource.getCharacterStream() != null) {
|
||||
document = builder.build(inputSource.getCharacterStream());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"InputSource in SAXSource contains neither byte stream nor character stream");
|
||||
}
|
||||
element = document.getRootElement();
|
||||
}
|
||||
catch (ValidityException ex) {
|
||||
} catch (ValidityException ex) {
|
||||
throw new XomParsingException(ex);
|
||||
}
|
||||
catch (ParsingException ex) {
|
||||
} catch (ParsingException ex) {
|
||||
throw new XomParsingException(ex);
|
||||
}
|
||||
}
|
||||
@@ -177,8 +170,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
Builder builder = new Builder();
|
||||
Document document = builder.build(inputStream);
|
||||
element = document.getRootElement();
|
||||
}
|
||||
catch (ParsingException ex) {
|
||||
} catch (ParsingException ex) {
|
||||
throw new XomParsingException(ex);
|
||||
}
|
||||
}
|
||||
@@ -189,8 +181,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
Builder builder = new Builder();
|
||||
Document document = builder.build(reader);
|
||||
element = document.getRootElement();
|
||||
}
|
||||
catch (ParsingException ex) {
|
||||
} catch (ParsingException ex) {
|
||||
throw new XomParsingException(ex);
|
||||
}
|
||||
}
|
||||
@@ -201,8 +192,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
Builder builder = new Builder();
|
||||
Document document = builder.build(systemId);
|
||||
element = document.getRootElement();
|
||||
}
|
||||
catch (ParsingException ex) {
|
||||
} catch (ParsingException ex) {
|
||||
throw new XomParsingException(ex);
|
||||
}
|
||||
}
|
||||
@@ -244,8 +234,7 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
if (element == null) {
|
||||
element = nodeFactory.makeRootElement(name, streamReader.getNamespaceURI());
|
||||
document.setRootElement(element);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
element = nodeFactory.startMakingElement(name, streamReader.getNamespaceURI());
|
||||
parent.appendChild(element);
|
||||
}
|
||||
@@ -301,35 +290,25 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
type = type.toUpperCase(Locale.ENGLISH);
|
||||
if ("CDATA".equals(type)) {
|
||||
return Attribute.Type.CDATA;
|
||||
}
|
||||
else if ("ENTITIES".equals(type)) {
|
||||
} else if ("ENTITIES".equals(type)) {
|
||||
return Attribute.Type.ENTITIES;
|
||||
}
|
||||
else if ("ENTITY".equals(type)) {
|
||||
} else if ("ENTITY".equals(type)) {
|
||||
return Attribute.Type.ENTITY;
|
||||
}
|
||||
else if ("ENUMERATION".equals(type)) {
|
||||
} else if ("ENUMERATION".equals(type)) {
|
||||
return Attribute.Type.ENUMERATION;
|
||||
}
|
||||
else if ("ID".equals(type)) {
|
||||
} else if ("ID".equals(type)) {
|
||||
return Attribute.Type.ID;
|
||||
}
|
||||
else if ("IDREF".equals(type)) {
|
||||
} else if ("IDREF".equals(type)) {
|
||||
return Attribute.Type.IDREF;
|
||||
}
|
||||
else if ("IDREFS".equals(type)) {
|
||||
} else if ("IDREFS".equals(type)) {
|
||||
return Attribute.Type.IDREFS;
|
||||
}
|
||||
else if ("NMTOKEN".equals(type)) {
|
||||
} else if ("NMTOKEN".equals(type)) {
|
||||
return Attribute.Type.NMTOKEN;
|
||||
}
|
||||
else if ("NMTOKENS".equals(type)) {
|
||||
} else if ("NMTOKENS".equals(type)) {
|
||||
return Attribute.Type.NMTOKENS;
|
||||
}
|
||||
else if ("NOTATION".equals(type)) {
|
||||
} else if ("NOTATION".equals(type)) {
|
||||
return Attribute.Type.NOTATION;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return Attribute.Type.UNDECLARED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Defines the basic contract for Web Services interested in the entire message payload.
|
||||
*
|
||||
* <p>The main entrypoint is {@link #invoke(MessageContext)}, which gets invoked with the message context. This context
|
||||
* <p>
|
||||
* The main entrypoint is {@link #invoke(MessageContext)}, which gets invoked with the message context. This context
|
||||
* contains the {@link MessageContext#getRequest() request}, and can be used to create a response.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -32,8 +32,8 @@ public interface MessageEndpoint {
|
||||
|
||||
/**
|
||||
* Invokes an operation.
|
||||
*
|
||||
* <p>The given {@code messageContext} can be used to create a response.
|
||||
* <p>
|
||||
* The given {@code messageContext} can be used to create a response.
|
||||
*
|
||||
* @param messageContext the message context
|
||||
* @throws Exception if an exception occurs
|
||||
|
||||
@@ -26,8 +26,8 @@ import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Represents a bean method that will be invoked as part of an incoming Web service message.
|
||||
*
|
||||
* <p>Consists of a {@link Method}, and a bean {@link Object}.
|
||||
* <p>
|
||||
* Consists of a {@link Method}, and a bean {@link Object}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
@@ -43,7 +43,7 @@ public final class MethodEndpoint {
|
||||
/**
|
||||
* Constructs a new method endpoint with the given bean and method.
|
||||
*
|
||||
* @param bean the object bean
|
||||
* @param bean the object bean
|
||||
* @param method the method
|
||||
*/
|
||||
public MethodEndpoint(Object bean, Method method) {
|
||||
@@ -57,8 +57,8 @@ public final class MethodEndpoint {
|
||||
/**
|
||||
* Constructs a new method endpoint with the given bean, method name and parameters.
|
||||
*
|
||||
* @param bean the object bean
|
||||
* @param methodName the method name
|
||||
* @param bean the object bean
|
||||
* @param methodName the method name
|
||||
* @param parameterTypes the method parameter types
|
||||
* @throws NoSuchMethodException when the method cannot be found
|
||||
*/
|
||||
@@ -74,9 +74,9 @@ public final class MethodEndpoint {
|
||||
* Constructs a new method endpoint with the given bean name and method. The bean name will be lazily initialized when
|
||||
* {@link #invoke(Object...)} is called.
|
||||
*
|
||||
* @param beanName the bean name
|
||||
* @param beanName the bean name
|
||||
* @param beanFactory the bean factory to use for bean initialization
|
||||
* @param method the method
|
||||
* @param method the method
|
||||
*/
|
||||
public MethodEndpoint(String beanName, BeanFactory beanFactory, Method method) {
|
||||
Assert.hasText(beanName, "'beanName' must not be null");
|
||||
@@ -94,8 +94,7 @@ public final class MethodEndpoint {
|
||||
if (beanFactory != null && bean instanceof String) {
|
||||
String beanName = (String) bean;
|
||||
return beanFactory.getBean(beanName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
@@ -132,12 +131,10 @@ public final class MethodEndpoint {
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
try {
|
||||
return method.invoke(endpoint, args);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
} catch (InvocationTargetException ex) {
|
||||
handleInvocationTargetException(ex);
|
||||
throw new IllegalStateException(
|
||||
"Unexpected exception thrown by method - " + ex.getTargetException().getClass().getName() + ": " +
|
||||
ex.getTargetException().getMessage());
|
||||
throw new IllegalStateException("Unexpected exception thrown by method - "
|
||||
+ ex.getTargetException().getClass().getName() + ": " + ex.getTargetException().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import javax.xml.transform.Source;
|
||||
|
||||
/**
|
||||
* Defines the basic contract for Web Services interested in just the message payload.
|
||||
*
|
||||
* <p>The main entrypoint is {@link #invoke(Source)}, which gets invoked with the contents of the requesting message.
|
||||
* <p>
|
||||
* The main entrypoint is {@link #invoke(Source)}, which gets invoked with the contents of the requesting message.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
|
||||
@@ -45,9 +45,8 @@ public abstract class AbstractMethodEndpointAdapter extends TransformerObjectSup
|
||||
* Delegates to {@link #invokeInternal(org.springframework.ws.context.MessageContext,MethodEndpoint)}.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
* @param endpoint the endpoint to use. This object must have previously been passed to the
|
||||
* {@code supportsInternal} method of this interface, which must have returned
|
||||
* {@code true}
|
||||
* @param endpoint the endpoint to use. This object must have previously been passed to the {@code supportsInternal}
|
||||
* method of this interface, which must have returned {@code true}
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
@Override
|
||||
@@ -70,7 +69,6 @@ public abstract class AbstractMethodEndpointAdapter extends TransformerObjectSup
|
||||
* @param methodEndpoint the method endpoint to use
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
protected abstract void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint)
|
||||
throws Exception;
|
||||
protected abstract void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,9 @@ import org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPay
|
||||
import org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor;
|
||||
|
||||
/**
|
||||
* Default extension of {@link AbstractMethodEndpointAdapter} with support for pluggable {@linkplain
|
||||
* MethodArgumentResolver argument resolvers} and {@linkplain MethodReturnValueHandler return value handlers}.
|
||||
* Default extension of {@link AbstractMethodEndpointAdapter} with support for pluggable
|
||||
* {@linkplain MethodArgumentResolver argument resolvers} and {@linkplain MethodReturnValueHandler return value
|
||||
* handlers}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -61,11 +62,9 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
private static final String XOM_CLASS_NAME = "nu.xom.Element";
|
||||
|
||||
private static final String SOAP_METHOD_ARGUMENT_RESOLVER_CLASS_NAME =
|
||||
"org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver";
|
||||
private static final String SOAP_METHOD_ARGUMENT_RESOLVER_CLASS_NAME = "org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver";
|
||||
|
||||
private static final String SOAP_HEADER_ELEMENT_ARGUMENT_RESOLVER_CLASS_NAME =
|
||||
"org.springframework.ws.soap.server.endpoint.adapter.method.SoapHeaderElementMethodArgumentResolver";
|
||||
private static final String SOAP_HEADER_ELEMENT_ARGUMENT_RESOLVER_CLASS_NAME = "org.springframework.ws.soap.server.endpoint.adapter.method.SoapHeaderElementMethodArgumentResolver";
|
||||
|
||||
private List<MethodArgumentResolver> methodArgumentResolvers;
|
||||
|
||||
@@ -99,12 +98,10 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the custom handlers for method arguments. Custom handlers are
|
||||
* ordered after built-in ones. To override the built-in support for
|
||||
* return value handling use {@link #setMethodArgumentResolvers(List)}.
|
||||
* Sets the custom handlers for method arguments. Custom handlers are ordered after built-in ones. To override the
|
||||
* built-in support for return value handling use {@link #setMethodArgumentResolvers(List)}.
|
||||
*/
|
||||
public void setCustomMethodArgumentResolvers(
|
||||
List<MethodArgumentResolver> customMethodArgumentResolvers) {
|
||||
public void setCustomMethodArgumentResolvers(List<MethodArgumentResolver> customMethodArgumentResolvers) {
|
||||
this.customMethodArgumentResolvers = customMethodArgumentResolvers;
|
||||
}
|
||||
|
||||
@@ -130,12 +127,10 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the handlers for custom return value types. Custom handlers are
|
||||
* ordered after built-in ones. To override the built-in support for
|
||||
* return value handling use {@link #setMethodReturnValueHandlers(List)}.
|
||||
* Sets the handlers for custom return value types. Custom handlers are ordered after built-in ones. To override the
|
||||
* built-in support for return value handling use {@link #setMethodReturnValueHandlers(List)}.
|
||||
*/
|
||||
public void setCustomMethodReturnValueHandlers(
|
||||
List<MethodReturnValueHandler> customMethodReturnValueHandlers) {
|
||||
public void setCustomMethodReturnValueHandlers(List<MethodReturnValueHandler> customMethodReturnValueHandlers) {
|
||||
this.customMethodReturnValueHandlers = customMethodReturnValueHandlers;
|
||||
}
|
||||
|
||||
@@ -201,11 +196,10 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addMethodArgumentResolver(String className, List<MethodArgumentResolver> methodArgumentResolvers) {
|
||||
try {
|
||||
Class<MethodArgumentResolver> methodArgumentResolverClass =
|
||||
(Class<MethodArgumentResolver>) ClassUtils.forName(className, getClassLoader());
|
||||
Class<MethodArgumentResolver> methodArgumentResolverClass = (Class<MethodArgumentResolver>) ClassUtils
|
||||
.forName(className, getClassLoader());
|
||||
methodArgumentResolvers.add(BeanUtils.instantiateClass(methodArgumentResolverClass));
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.warn("Could not find \"" + className + "\" on the classpath");
|
||||
}
|
||||
}
|
||||
@@ -244,8 +238,8 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
@Override
|
||||
protected boolean supportsInternal(MethodEndpoint methodEndpoint) {
|
||||
return supportsParameters(methodEndpoint.getMethodParameters()) &&
|
||||
supportsReturnType(methodEndpoint.getReturnType());
|
||||
return supportsParameters(methodEndpoint.getMethodParameters())
|
||||
&& supportsReturnType(methodEndpoint.getReturnType());
|
||||
}
|
||||
|
||||
private boolean supportsParameters(MethodParameter[] methodParameters) {
|
||||
@@ -253,8 +247,8 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
boolean supported = false;
|
||||
for (MethodArgumentResolver methodArgumentResolver : methodArgumentResolvers) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Testing if argument resolver [" + methodArgumentResolver + "] supports [" +
|
||||
methodParameter.getGenericParameterType() + "]");
|
||||
logger.trace("Testing if argument resolver [" + methodArgumentResolver + "] supports ["
|
||||
+ methodParameter.getGenericParameterType() + "]");
|
||||
}
|
||||
if (methodArgumentResolver.supportsParameter(methodParameter)) {
|
||||
supported = true;
|
||||
@@ -302,8 +296,8 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
/**
|
||||
* Returns the argument array for the given method endpoint.
|
||||
*
|
||||
* <p>This implementation iterates over the set {@linkplain #setMethodArgumentResolvers(List) argument resolvers} to
|
||||
* <p>
|
||||
* This implementation iterates over the set {@linkplain #setMethodArgumentResolvers(List) argument resolvers} to
|
||||
* resolve each argument.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
@@ -311,8 +305,7 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
* @return the arguments
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
protected Object[] getMethodArguments(MessageContext messageContext, MethodEndpoint methodEndpoint)
|
||||
throws Exception {
|
||||
protected Object[] getMethodArguments(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
|
||||
MethodParameter[] parameters = methodEndpoint.getMethodParameters();
|
||||
Object[] args = new Object[parameters.length];
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
@@ -328,18 +321,17 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
/**
|
||||
* Handle the return value for the given method endpoint.
|
||||
*
|
||||
* <p>This implementation iterates over the set {@linkplain #setMethodReturnValueHandlers(java.util.List)} return value
|
||||
* <p>
|
||||
* This implementation iterates over the set {@linkplain #setMethodReturnValueHandlers(java.util.List)} return value
|
||||
* handlers} to resolve the return value.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
* @param returnValue the return value
|
||||
* @param returnValue the return value
|
||||
* @param methodEndpoint the method endpoint to get arguments for
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
protected void handleMethodReturnValue(MessageContext messageContext,
|
||||
Object returnValue,
|
||||
MethodEndpoint methodEndpoint) throws Exception {
|
||||
protected void handleMethodReturnValue(MessageContext messageContext, Object returnValue,
|
||||
MethodEndpoint methodEndpoint) throws Exception {
|
||||
MethodParameter returnType = methodEndpoint.getReturnType();
|
||||
for (MethodReturnValueHandler methodReturnValueHandler : methodReturnValueHandlers) {
|
||||
if (methodReturnValueHandler.supportsReturnType(returnType)) {
|
||||
@@ -347,7 +339,6 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException(
|
||||
"Return value [" + returnValue + "] not resolved by any MethodReturnValueHandler");
|
||||
throw new IllegalStateException("Return value [" + returnValue + "] not resolved by any MethodReturnValueHandler");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,43 +26,41 @@ import org.springframework.oxm.jaxb.Jaxb2Marshaller;
|
||||
import org.springframework.ws.server.endpoint.MethodEndpoint;
|
||||
|
||||
/**
|
||||
* Subclass of {@link MarshallingMethodEndpointAdapter} that supports {@link GenericMarshaller} and {@link
|
||||
* GenericUnmarshaller}. More specifically, this adapter is aware of the {@link Method#getGenericParameterTypes()} and
|
||||
* {@link Method#getGenericReturnType()}.
|
||||
*
|
||||
* <p>Prefer to use this adapter rather than the plain {@link MarshallingMethodEndpointAdapter} in combination with Java 5
|
||||
* Subclass of {@link MarshallingMethodEndpointAdapter} that supports {@link GenericMarshaller} and
|
||||
* {@link GenericUnmarshaller}. More specifically, this adapter is aware of the
|
||||
* {@link Method#getGenericParameterTypes()} and {@link Method#getGenericReturnType()}.
|
||||
* <p>
|
||||
* Prefer to use this adapter rather than the plain {@link MarshallingMethodEndpointAdapter} in combination with Java 5
|
||||
* marshallers, such as the {@link Jaxb2Marshaller}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.2
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor
|
||||
* MarshallingPayloadMethodProcessor}.
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor
|
||||
* MarshallingPayloadMethodProcessor}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class GenericMarshallingMethodEndpointAdapter extends MarshallingMethodEndpointAdapter {
|
||||
|
||||
/**
|
||||
* Creates a new {@code GenericMarshallingMethodEndpointAdapter}. The {@link Marshaller} and {@link
|
||||
* Unmarshaller} must be injected using properties.
|
||||
* Creates a new {@code GenericMarshallingMethodEndpointAdapter}. The {@link Marshaller} and {@link Unmarshaller} must
|
||||
* be injected using properties.
|
||||
*
|
||||
* @see #setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see #setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
*/
|
||||
public GenericMarshallingMethodEndpointAdapter() {
|
||||
}
|
||||
public GenericMarshallingMethodEndpointAdapter() {}
|
||||
|
||||
/**
|
||||
* Creates a new {@code GenericMarshallingMethodEndpointAdapter} with the given marshaller. If the given {@link
|
||||
* Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
|
||||
* Creates a new {@code GenericMarshallingMethodEndpointAdapter} with the given marshaller. If the given
|
||||
* {@link Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
|
||||
* unmarshalling. Otherwise, an exception is thrown.
|
||||
*
|
||||
* <p>Note that all {@link Marshaller} implementations in Spring-WS also implement the {@link Unmarshaller} interface,
|
||||
* so that you can safely use this constructor.
|
||||
* <p>
|
||||
* Note that all {@link Marshaller} implementations in Spring-WS also implement the {@link Unmarshaller} interface, so
|
||||
* that you can safely use this constructor.
|
||||
*
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller}
|
||||
* interface
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller} interface
|
||||
*/
|
||||
public GenericMarshallingMethodEndpointAdapter(Marshaller marshaller) {
|
||||
super(marshaller);
|
||||
@@ -71,7 +69,7 @@ public class GenericMarshallingMethodEndpointAdapter extends MarshallingMethodEn
|
||||
/**
|
||||
* Creates a new {@code GenericMarshallingMethodEndpointAdapter} with the given marshaller and unmarshaller.
|
||||
*
|
||||
* @param marshaller the marshaller to use
|
||||
* @param marshaller the marshaller to use
|
||||
* @param unmarshaller the unmarshaller to use
|
||||
*/
|
||||
public GenericMarshallingMethodEndpointAdapter(Marshaller marshaller, Unmarshaller unmarshaller) {
|
||||
@@ -87,12 +85,10 @@ public class GenericMarshallingMethodEndpointAdapter extends MarshallingMethodEn
|
||||
private boolean supportsReturnType(Method method) {
|
||||
if (Void.TYPE.equals(method.getReturnType())) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (getMarshaller() instanceof GenericMarshaller) {
|
||||
return ((GenericMarshaller) getMarshaller()).supports(method.getGenericReturnType());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getMarshaller().supports(method.getReturnType());
|
||||
}
|
||||
}
|
||||
@@ -101,12 +97,10 @@ public class GenericMarshallingMethodEndpointAdapter extends MarshallingMethodEn
|
||||
private boolean supportsParameters(Method method) {
|
||||
if (method.getParameterTypes().length != 1) {
|
||||
return false;
|
||||
}
|
||||
else if (getUnmarshaller() instanceof GenericUnmarshaller) {
|
||||
} else if (getUnmarshaller() instanceof GenericUnmarshaller) {
|
||||
GenericUnmarshaller genericUnmarshaller = (GenericUnmarshaller) getUnmarshaller();
|
||||
return genericUnmarshaller.supports(method.getGenericParameterTypes()[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getUnmarshaller().supports(method.getParameterTypes()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,27 +31,30 @@ import org.springframework.ws.support.MarshallingUtils;
|
||||
|
||||
/**
|
||||
* Adapter that supports endpoint methods that use marshalling. Supports methods with the following signature:
|
||||
*
|
||||
* <pre>
|
||||
* void handleMyMessage(MyUnmarshalledType request);
|
||||
* </pre>
|
||||
*
|
||||
* or
|
||||
*
|
||||
* <pre>
|
||||
* MyMarshalledType handleMyMessage(MyUnmarshalledType request);
|
||||
* </pre>
|
||||
* I.e. methods that take a single parameter that {@link Unmarshaller#supports(Class) is supported} by the {@link
|
||||
* Unmarshaller}, and return either {@code void} or a type {@link Marshaller#supports(Class) supported} by the
|
||||
*
|
||||
* I.e. methods that take a single parameter that {@link Unmarshaller#supports(Class) is supported} by the
|
||||
* {@link Unmarshaller}, and return either {@code void} or a type {@link Marshaller#supports(Class) supported} by the
|
||||
* {@link Marshaller}. The method can have any name, as long as it is mapped by an {@link EndpointMapping}.
|
||||
*
|
||||
* <p>This endpoint needs a {@code Marshaller} and {@code Unmarshaller}, both of which can be set using
|
||||
* properties.
|
||||
* <p>
|
||||
* This endpoint needs a {@code Marshaller} and {@code Unmarshaller}, both of which can be set using properties.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see #setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see #setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
* @since 1.0.0
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor
|
||||
* MarshallingPayloadMethodProcessor}.
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor
|
||||
* MarshallingPayloadMethodProcessor}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdapter implements InitializingBean {
|
||||
@@ -61,35 +64,32 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
private Unmarshaller unmarshaller;
|
||||
|
||||
/**
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter}. The {@link Marshaller} and {@link Unmarshaller} must
|
||||
* be injected using properties.
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter}. The {@link Marshaller} and {@link Unmarshaller} must be
|
||||
* injected using properties.
|
||||
*
|
||||
* @see #setMarshaller(org.springframework.oxm.Marshaller)
|
||||
* @see #setUnmarshaller(org.springframework.oxm.Unmarshaller)
|
||||
*/
|
||||
public MarshallingMethodEndpointAdapter() {
|
||||
}
|
||||
public MarshallingMethodEndpointAdapter() {}
|
||||
|
||||
/**
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter} with the given marshaller. If the given {@link
|
||||
* Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
|
||||
* unmarshalling. Otherwise, an exception is thrown.
|
||||
*
|
||||
* <p>Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface,
|
||||
* so that you can safely use this constructor.
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter} with the given marshaller. If the given {@link Marshaller}
|
||||
* also implements the {@link Unmarshaller} interface, it is used for both marshalling and unmarshalling. Otherwise,
|
||||
* an exception is thrown.
|
||||
* <p>
|
||||
* Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface, so
|
||||
* that you can safely use this constructor.
|
||||
*
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller}
|
||||
* interface
|
||||
* @throws IllegalArgumentException when {@code marshaller} does not implement the {@link Unmarshaller} interface
|
||||
*/
|
||||
public MarshallingMethodEndpointAdapter(Marshaller marshaller) {
|
||||
Assert.notNull(marshaller, "marshaller must not be null");
|
||||
if (!(marshaller instanceof Unmarshaller)) {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller " +
|
||||
"interface. Please set an Unmarshaller explicitly by using the " +
|
||||
"MarshallingMethodEndpointAdapter(Marshaller, Unmarshaller) constructor.");
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Marshaller [" + marshaller + "] does not implement the Unmarshaller "
|
||||
+ "interface. Please set an Unmarshaller explicitly by using the "
|
||||
+ "MarshallingMethodEndpointAdapter(Marshaller, Unmarshaller) constructor.");
|
||||
} else {
|
||||
this.setMarshaller(marshaller);
|
||||
this.setUnmarshaller((Unmarshaller) marshaller);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
/**
|
||||
* Creates a new {@code MarshallingMethodEndpointAdapter} with the given marshaller and unmarshaller.
|
||||
*
|
||||
* @param marshaller the marshaller to use
|
||||
* @param marshaller the marshaller to use
|
||||
* @param unmarshaller the unmarshaller to use
|
||||
*/
|
||||
public MarshallingMethodEndpointAdapter(Marshaller marshaller, Unmarshaller unmarshaller) {
|
||||
@@ -138,7 +138,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
protected void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
|
||||
WebServiceMessage request = messageContext.getRequest();
|
||||
Object requestObject = unmarshalRequest(request);
|
||||
Object responseObject = methodEndpoint.invoke(new Object[]{requestObject});
|
||||
Object responseObject = methodEndpoint.invoke(new Object[] { requestObject });
|
||||
if (responseObject != null) {
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
marshalResponse(responseObject, response);
|
||||
@@ -161,8 +161,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
}
|
||||
|
||||
/**
|
||||
* Supports a method with a single, unmarshallable parameter, and that return {@code void} or a marshallable
|
||||
* type.
|
||||
* Supports a method with a single, unmarshallable parameter, and that return {@code void} or a marshallable type.
|
||||
*
|
||||
* @see Marshaller#supports(Class)
|
||||
* @see Unmarshaller#supports(Class)
|
||||
@@ -180,8 +179,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
private boolean supportsParameters(Method method) {
|
||||
if (method.getParameterTypes().length != 1) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getUnmarshaller().supports(method.getParameterTypes()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.ws.soap.server.SoapMessageDispatcher;
|
||||
|
||||
/**
|
||||
* Adapter to use a {@code MessageEndpoint} as the endpoint for a {@code EndpointInvocationChain}.
|
||||
*
|
||||
* <p>This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
* <p>
|
||||
* This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.server.EndpointInvocationChain
|
||||
|
||||
@@ -25,19 +25,21 @@ import org.springframework.ws.soap.server.SoapMessageDispatcher;
|
||||
|
||||
/**
|
||||
* Adapter that supports endpoint methods with message contexts. Supports methods with the following signature:
|
||||
*
|
||||
* <pre>
|
||||
* void handleMyMessage(MessageContext request);
|
||||
* </pre>
|
||||
* I.e. methods that take a single {@link MessageContext} parameter, and return {@code void}. The method can have
|
||||
* any name, as long as it is mapped by an {@link org.springframework.ws.server.EndpointMapping}.
|
||||
*
|
||||
* <p>This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* I.e. methods that take a single {@link MessageContext} parameter, and return {@code void}. The method can have any
|
||||
* name, as long as it is mapped by an {@link org.springframework.ws.server.EndpointMapping}.
|
||||
* <p>
|
||||
* This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.method.MessageContextMethodArgumentResolver
|
||||
* MessageContextMethodArgumentResolver}.
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.method.MessageContextMethodArgumentResolver
|
||||
* MessageContextMethodArgumentResolver}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MessageMethodEndpointAdapter extends AbstractMethodEndpointAdapter {
|
||||
@@ -45,8 +47,8 @@ public class MessageMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
@Override
|
||||
protected boolean supportsInternal(MethodEndpoint methodEndpoint) {
|
||||
Method method = methodEndpoint.getMethod();
|
||||
return Void.TYPE.isAssignableFrom(method.getReturnType()) && method.getParameterTypes().length == 1 &&
|
||||
MessageContext.class.isAssignableFrom(method.getParameterTypes()[0]);
|
||||
return Void.TYPE.isAssignableFrom(method.getReturnType()) && method.getParameterTypes().length == 1
|
||||
&& MessageContext.class.isAssignableFrom(method.getParameterTypes()[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
|
||||
/**
|
||||
* Adapter to use a {@code PayloadEndpoint} as the endpoint for a {@code EndpointInvocationChain}.
|
||||
*
|
||||
* <p>This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
* <p>
|
||||
* This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.server.endpoint.PayloadEndpoint
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.ws.server.endpoint.adapter;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
@@ -27,23 +28,27 @@ import org.springframework.ws.soap.server.SoapMessageDispatcher;
|
||||
|
||||
/**
|
||||
* Adapter that supports endpoint methods that use marshalling. Supports methods with the following signature:
|
||||
*
|
||||
* <pre>
|
||||
* void handleMyMessage(Source request);
|
||||
* </pre>
|
||||
*
|
||||
* or
|
||||
*
|
||||
* <pre>
|
||||
* Source handleMyMessage(Source request);
|
||||
* </pre>
|
||||
* I.e. methods that take a single {@link Source} parameter, and return either {@code void} or a {@link Source}.
|
||||
* The method can have any name, as long as it is mapped by an {@link org.springframework.ws.server.EndpointMapping}.
|
||||
*
|
||||
* <p>This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* I.e. methods that take a single {@link Source} parameter, and return either {@code void} or a {@link Source}. The
|
||||
* method can have any name, as long as it is mapped by an {@link org.springframework.ws.server.EndpointMapping}.
|
||||
* <p>
|
||||
* This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor
|
||||
* SourcePayloadMethodProcessor}.
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor
|
||||
* SourcePayloadMethodProcessor}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class PayloadMethodEndpointAdapter extends AbstractMethodEndpointAdapter {
|
||||
@@ -51,9 +56,8 @@ public class PayloadMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
@Override
|
||||
protected boolean supportsInternal(MethodEndpoint methodEndpoint) {
|
||||
Method method = methodEndpoint.getMethod();
|
||||
return (Void.TYPE.isAssignableFrom(method.getReturnType()) ||
|
||||
Source.class.isAssignableFrom(method.getReturnType())) && method.getParameterTypes().length == 1 &&
|
||||
Source.class.isAssignableFrom(method.getParameterTypes()[0]);
|
||||
return (Void.TYPE.isAssignableFrom(method.getReturnType()) || Source.class.isAssignableFrom(method.getReturnType()))
|
||||
&& method.getParameterTypes().length == 1 && Source.class.isAssignableFrom(method.getParameterTypes()[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.ws.server.endpoint.adapter;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
@@ -28,38 +29,47 @@ import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.server.endpoint.MethodEndpoint;
|
||||
import org.springframework.ws.server.endpoint.annotation.XPathParam;
|
||||
import org.springframework.xml.namespace.SimpleNamespaceContext;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Adapter that supports endpoint methods that use XPath expressions. Supports methods with the following signature:
|
||||
*
|
||||
* <pre>
|
||||
* void handleMyMessage(@XPathParam("/root/child/text")String param);
|
||||
* void handleMyMessage(@XPathParam("/root/child/text") String param);
|
||||
* </pre>
|
||||
*
|
||||
* or
|
||||
*
|
||||
* <pre>
|
||||
* Source handleMyMessage(@XPathParam("/root/child/text")String param1, @XPathParam("/root/child/number")double
|
||||
* param2);
|
||||
* Source handleMyMessage(@XPathParam("/root/child/text") String param1,
|
||||
* @XPathParam("/root/child/number") double param2);
|
||||
* </pre>
|
||||
* I.e. methods that return either {@code void} or a {@link Source}, and have parameters annotated with {@link
|
||||
* XPathParam} that specify the XPath expression that should be bound to that parameter. The parameter can be of the
|
||||
* following types: <ul> <li>{@code boolean}, or {@link Boolean}</li> <li>{@code double}, or {@link
|
||||
* Double}</li> <li>{@link String}</li> <li>{@link Node}</li> <li>{@link NodeList}</li> </ul>
|
||||
*
|
||||
* I.e. methods that return either {@code void} or a {@link Source}, and have parameters annotated with
|
||||
* {@link XPathParam} that specify the XPath expression that should be bound to that parameter. The parameter can be of
|
||||
* the following types:
|
||||
* <ul>
|
||||
* <li>{@code boolean}, or {@link Boolean}</li>
|
||||
* <li>{@code double}, or {@link Double}</li>
|
||||
* <li>{@link String}</li>
|
||||
* <li>{@link Node}</li>
|
||||
* <li>{@link NodeList}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.0.0
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.method.XPathParamMethodArgumentResolver
|
||||
* XPathParamMethodArgumentResolver}.
|
||||
* @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.method.XPathParamMethodArgumentResolver
|
||||
* XPathParamMethodArgumentResolver}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
@@ -106,10 +116,10 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
|
||||
}
|
||||
|
||||
private boolean isSupportedType(Class<?> clazz) {
|
||||
return Boolean.class.isAssignableFrom(clazz) || Boolean.TYPE.isAssignableFrom(clazz) ||
|
||||
Double.class.isAssignableFrom(clazz) || Double.TYPE.isAssignableFrom(clazz) ||
|
||||
Node.class.isAssignableFrom(clazz) || NodeList.class.isAssignableFrom(clazz) ||
|
||||
String.class.isAssignableFrom(clazz);
|
||||
return Boolean.class.isAssignableFrom(clazz) || Boolean.TYPE.isAssignableFrom(clazz)
|
||||
|| Double.class.isAssignableFrom(clazz) || Double.TYPE.isAssignableFrom(clazz)
|
||||
|| Node.class.isAssignableFrom(clazz) || NodeList.class.isAssignableFrom(clazz)
|
||||
|| String.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,23 +143,17 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
|
||||
QName conversionType;
|
||||
if (Boolean.class.isAssignableFrom(parameterTypes[i]) || Boolean.TYPE.isAssignableFrom(parameterTypes[i])) {
|
||||
conversionType = XPathConstants.BOOLEAN;
|
||||
}
|
||||
else
|
||||
if (Double.class.isAssignableFrom(parameterTypes[i]) || Double.TYPE.isAssignableFrom(parameterTypes[i])) {
|
||||
} else if (Double.class.isAssignableFrom(parameterTypes[i]) || Double.TYPE.isAssignableFrom(parameterTypes[i])) {
|
||||
conversionType = XPathConstants.NUMBER;
|
||||
}
|
||||
else if (Node.class.isAssignableFrom(parameterTypes[i])) {
|
||||
} else if (Node.class.isAssignableFrom(parameterTypes[i])) {
|
||||
conversionType = XPathConstants.NODE;
|
||||
}
|
||||
else if (NodeList.class.isAssignableFrom(parameterTypes[i])) {
|
||||
} else if (NodeList.class.isAssignableFrom(parameterTypes[i])) {
|
||||
conversionType = XPathConstants.NODESET;
|
||||
}
|
||||
else if (String.class.isAssignableFrom(parameterTypes[i])) {
|
||||
} else if (String.class.isAssignableFrom(parameterTypes[i])) {
|
||||
conversionType = XPathConstants.STRING;
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Invalid parameter type [" + parameterTypes[i] + "]. " +
|
||||
"Supported are: Boolean, Double, Node, NodeList, and String.");
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid parameter type [" + parameterTypes[i] + "]. "
|
||||
+ "Supported are: Boolean, Double, Node, NodeList, and String.");
|
||||
}
|
||||
args[i] = xpath.evaluate(expression, payloadElement, conversionType);
|
||||
}
|
||||
@@ -179,5 +183,4 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
|
||||
return document.getDocumentElement();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.server.endpoint.adapter.method;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
@@ -42,8 +43,8 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>This implementation gets checks if the given parameter is annotated with {@link RequestPayload}, and invokes
|
||||
* <p>
|
||||
* This implementation gets checks if the given parameter is annotated with {@link RequestPayload}, and invokes
|
||||
* {@link #supportsRequestPayloadParameter(org.springframework.core.MethodParameter)} afterwards.
|
||||
*/
|
||||
@Override
|
||||
@@ -51,8 +52,7 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
|
||||
Assert.isTrue(parameter.getParameterIndex() >= 0, "Parameter index smaller than 0");
|
||||
if (parameter.getParameterAnnotation(RequestPayload.class) == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return supportsRequestPayloadParameter(parameter);
|
||||
}
|
||||
}
|
||||
@@ -67,11 +67,11 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
|
||||
protected abstract boolean supportsRequestPayloadParameter(MethodParameter parameter);
|
||||
|
||||
// MethodReturnValueHandler
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>This implementation gets checks if the method of the given return type is annotated with {@link ResponsePayload},
|
||||
* <p>
|
||||
* This implementation gets checks if the method of the given return type is annotated with {@link ResponsePayload},
|
||||
* and invokes {@link #supportsResponsePayloadReturnType(org.springframework.core.MethodParameter)} afterwards.
|
||||
*/
|
||||
@Override
|
||||
@@ -79,15 +79,14 @@ public abstract class AbstractPayloadMethodProcessor extends TransformerObjectSu
|
||||
Assert.isTrue(returnType.getParameterIndex() == -1, "Parameter index is not -1");
|
||||
if (returnType.getMethodAnnotation(ResponsePayload.class) == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return supportsResponsePayloadReturnType(returnType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the given {@linkplain MethodParameter method return type}, annotated with {@link
|
||||
* ResponsePayload}, is supported.
|
||||
* Indicates whether the given {@linkplain MethodParameter method return type}, annotated with
|
||||
* {@link ResponsePayload}, is supported.
|
||||
*
|
||||
* @param returnType the method parameter to check
|
||||
* @return {@code true} if this resolver supports the supplied return type; {@code false} otherwise
|
||||
|
||||
@@ -49,7 +49,7 @@ public abstract class AbstractPayloadSourceMethodProcessor extends AbstractPaylo
|
||||
/**
|
||||
* Resolves the given parameter, annotated with {@link RequestPayload}, into a method argument.
|
||||
*
|
||||
* @param parameter the parameter to resolve to an argument
|
||||
* @param parameter the parameter to resolve to an argument
|
||||
* @param requestPayload the request payload
|
||||
* @return the resolved argument. May be {@code null}.
|
||||
* @throws Exception in case of errors
|
||||
@@ -74,7 +74,7 @@ public abstract class AbstractPayloadSourceMethodProcessor extends AbstractPaylo
|
||||
/**
|
||||
* Creates a response payload for the given return value.
|
||||
*
|
||||
* @param returnType the return type to handle
|
||||
* @param returnType the return type to handle
|
||||
* @param returnValue the return value to handle
|
||||
* @return the response payload
|
||||
* @throws Exception in case of errors
|
||||
|
||||
@@ -46,15 +46,14 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
|
||||
* @see #setMarshaller(Marshaller)
|
||||
* @see #setUnmarshaller(Unmarshaller)
|
||||
*/
|
||||
public MarshallingPayloadMethodProcessor() {
|
||||
}
|
||||
public MarshallingPayloadMethodProcessor() {}
|
||||
|
||||
/**
|
||||
* Creates a new {@code MarshallingPayloadMethodProcessor} with the given marshaller. If the given {@link
|
||||
* Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
|
||||
* unmarshalling. Otherwise, an exception is thrown.
|
||||
*
|
||||
* <p>Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface, so
|
||||
* Creates a new {@code MarshallingPayloadMethodProcessor} with the given marshaller. If the given {@link Marshaller}
|
||||
* also implements the {@link Unmarshaller} interface, it is used for both marshalling and unmarshalling. Otherwise,
|
||||
* an exception is thrown.
|
||||
* <p>
|
||||
* Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface, so
|
||||
* that you can safely use this constructor.
|
||||
*
|
||||
* @param marshaller object used as marshaller and unmarshaller
|
||||
@@ -70,7 +69,7 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
|
||||
/**
|
||||
* Creates a new {@code MarshallingPayloadMethodProcessor} with the given marshaller and unmarshaller.
|
||||
*
|
||||
* @param marshaller the marshaller to use
|
||||
* @param marshaller the marshaller to use
|
||||
* @param unmarshaller the unmarshaller to use
|
||||
*/
|
||||
public MarshallingPayloadMethodProcessor(Marshaller marshaller, Unmarshaller unmarshaller) {
|
||||
@@ -113,11 +112,9 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
|
||||
Unmarshaller unmarshaller = getUnmarshaller();
|
||||
if (unmarshaller == null) {
|
||||
return false;
|
||||
}
|
||||
else if (unmarshaller instanceof GenericUnmarshaller) {
|
||||
} else if (unmarshaller instanceof GenericUnmarshaller) {
|
||||
return ((GenericUnmarshaller) unmarshaller).supports(parameter.getGenericParameterType());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return unmarshaller.supports(parameter.getParameterType());
|
||||
}
|
||||
}
|
||||
@@ -140,12 +137,10 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
|
||||
Marshaller marshaller = getMarshaller();
|
||||
if (marshaller == null) {
|
||||
return false;
|
||||
}
|
||||
else if (marshaller instanceof GenericMarshaller) {
|
||||
} else if (marshaller instanceof GenericMarshaller) {
|
||||
GenericMarshaller genericMarshaller = (GenericMarshaller) marshaller;
|
||||
return genericMarshaller.supports(returnType.getGenericParameterType());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return marshaller.supports(returnType.getParameterType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Strategy interface used to resolve method parameters into arguments. This interface is used to allow the {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter DefaultMethodEndpointAdapter} to be
|
||||
* indefinitely extensible.
|
||||
* Strategy interface used to resolve method parameters into arguments. This interface is used to allow the
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter DefaultMethodEndpointAdapter} to
|
||||
* be indefinitely extensible.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -41,9 +41,9 @@ public interface MethodArgumentResolver {
|
||||
* Resolves the given parameter into a method argument.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
* @param parameter the parameter to resolve to an argument. This parameter must have previously been passed to
|
||||
* the {@link #supportsParameter(MethodParameter)} method of this interface, which must
|
||||
* have returned {@code true}.
|
||||
* @param parameter the parameter to resolve to an argument. This parameter must have previously been passed to the
|
||||
* {@link #supportsParameter(MethodParameter)} method of this interface, which must have returned
|
||||
* {@code true}.
|
||||
* @return the resolved argument. May be {@code null}.
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
/**
|
||||
* Strategy interface used to handle method return values. This interface is used to allow the {@link
|
||||
* org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter DefaultMethodEndpointAdapter} to be
|
||||
* indefinitely extensible.
|
||||
* Strategy interface used to handle method return values. This interface is used to allow the
|
||||
* {@link org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter DefaultMethodEndpointAdapter} to
|
||||
* be indefinitely extensible.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -41,14 +41,13 @@ public interface MethodReturnValueHandler {
|
||||
* Handles the given return value.
|
||||
*
|
||||
* @param messageContext the current message context
|
||||
* @param returnType the return type to handle. This type must have previously been passed to the {@link
|
||||
* #supportsReturnType(MethodParameter)} method of this interface, which must have returned
|
||||
* {@code true}.
|
||||
* @param returnValue the return value to handle
|
||||
* @param returnType the return type to handle. This type must have previously been passed to the
|
||||
* {@link #supportsReturnType(MethodParameter)} method of this interface, which must have returned
|
||||
* {@code true}.
|
||||
* @param returnValue the return value to handle
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.ws.server.endpoint.adapter.method;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import javax.xml.stream.Location;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@@ -29,13 +30,12 @@ import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stax.StAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.xml.JaxpVersion;
|
||||
import org.springframework.xml.XMLInputFactoryUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Implementation of {@link MethodArgumentResolver} and {@link MethodReturnValueHandler} that supports {@link Source}
|
||||
@@ -67,28 +67,23 @@ public class SourcePayloadMethodProcessor extends AbstractPayloadSourceMethodPro
|
||||
Node node = domResult.getNode();
|
||||
if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
return new DOMSource(((Document) node).getDocumentElement());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return new DOMSource(domResult.getNode());
|
||||
}
|
||||
}
|
||||
else if (SAXSource.class.isAssignableFrom(parameterType)) {
|
||||
} else if (SAXSource.class.isAssignableFrom(parameterType)) {
|
||||
ByteArrayInputStream bis = convertToByteArrayInputStream(requestPayload);
|
||||
InputSource inputSource = new InputSource(bis);
|
||||
return new SAXSource(inputSource);
|
||||
}
|
||||
else if (StreamSource.class.isAssignableFrom(parameterType)) {
|
||||
} else if (StreamSource.class.isAssignableFrom(parameterType)) {
|
||||
ByteArrayInputStream bis = convertToByteArrayInputStream(requestPayload);
|
||||
return new StreamSource(bis);
|
||||
}
|
||||
else if (JaxpVersion.isAtLeastJaxp14() && Jaxp14StaxHandler.isStaxSource(parameterType)) {
|
||||
} else if (JaxpVersion.isAtLeastJaxp14() && Jaxp14StaxHandler.isStaxSource(parameterType)) {
|
||||
XMLStreamReader streamReader;
|
||||
try {
|
||||
streamReader = inputFactory.createXMLStreamReader(requestPayload);
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
streamReader = null;
|
||||
}
|
||||
catch (XMLStreamException ignored) {
|
||||
} catch (XMLStreamException ignored) {
|
||||
streamReader = null;
|
||||
}
|
||||
if (streamReader == null) {
|
||||
@@ -117,11 +112,11 @@ public class SourcePayloadMethodProcessor extends AbstractPayloadSourceMethodPro
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code XMLInputFactory} that this resolver will use to create {@link javax.xml.stream.XMLStreamReader}
|
||||
* and {@link javax.xml.stream.XMLEventReader} objects.
|
||||
*
|
||||
* <p>Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached,
|
||||
* so this method will only be called once.
|
||||
* Create a {@code XMLInputFactory} that this resolver will use to create {@link javax.xml.stream.XMLStreamReader} and
|
||||
* {@link javax.xml.stream.XMLEventReader} objects.
|
||||
* <p>
|
||||
* Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so
|
||||
* this method will only be called once.
|
||||
*
|
||||
* @return the created factory
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.server.endpoint.adapter.method;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@@ -34,8 +35,8 @@ import org.springframework.xml.XMLInputFactoryUtils;
|
||||
import org.springframework.xml.transform.TransformerObjectSupport;
|
||||
|
||||
/**
|
||||
* Implementation of {@link MethodArgumentResolver} that supports StAX {@link XMLStreamReader} and {@link
|
||||
* XMLEventReader} arguments.
|
||||
* Implementation of {@link MethodArgumentResolver} that supports StAX {@link XMLStreamReader} and
|
||||
* {@link XMLEventReader} arguments.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -48,8 +49,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
if (parameter.getParameterAnnotation(RequestPayload.class) == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Class<?> parameterType = parameter.getParameterType();
|
||||
return XMLStreamReader.class.equals(parameterType) || XMLEventReader.class.equals(parameterType);
|
||||
}
|
||||
@@ -65,8 +65,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
Class<?> parameterType = parameter.getParameterType();
|
||||
if (XMLStreamReader.class.equals(parameterType)) {
|
||||
return resolveStreamReader(source);
|
||||
}
|
||||
else if (XMLEventReader.class.equals(parameterType)) {
|
||||
} else if (XMLEventReader.class.equals(parameterType)) {
|
||||
return resolveEventReader(source);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -81,8 +80,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
if (eventReader != null) {
|
||||
try {
|
||||
streamReader = StaxUtils.createEventStreamReader(eventReader);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
}
|
||||
@@ -91,11 +89,9 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
if (streamReader == null) {
|
||||
try {
|
||||
streamReader = inputFactory.createXMLStreamReader(requestSource);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
streamReader = null;
|
||||
}
|
||||
}
|
||||
@@ -116,8 +112,7 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
if (streamReader != null) {
|
||||
try {
|
||||
eventReader = inputFactory.createXMLEventReader(streamReader);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
}
|
||||
@@ -127,11 +122,9 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
if (eventReader == null) {
|
||||
try {
|
||||
eventReader = inputFactory.createXMLEventReader(requestSource);
|
||||
}
|
||||
catch (XMLStreamException ex) {
|
||||
} catch (XMLStreamException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
eventReader = null;
|
||||
}
|
||||
}
|
||||
@@ -144,11 +137,11 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code XMLInputFactory} that this resolver will use to create {@link XMLStreamReader} and {@link
|
||||
* XMLEventReader} objects.
|
||||
*
|
||||
* <p>Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached,
|
||||
* so this method will only be called once.
|
||||
* Create a {@code XMLInputFactory} that this resolver will use to create {@link XMLStreamReader} and
|
||||
* {@link XMLEventReader} objects.
|
||||
* <p>
|
||||
* Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so
|
||||
* this method will only be called once.
|
||||
*
|
||||
* @return the created factory
|
||||
*/
|
||||
@@ -162,6 +155,4 @@ public class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport
|
||||
return new ByteArrayInputStream(bos.toByteArray());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,6 @@ import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
@@ -38,14 +33,18 @@ import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.server.endpoint.annotation.XPathParam;
|
||||
import org.springframework.ws.server.endpoint.support.NamespaceUtils;
|
||||
import org.springframework.xml.transform.TransformerHelper;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* Implementation of {@link MethodArgumentResolver} that supports the {@link XPathParam @XPathParam} annotation.
|
||||
*
|
||||
* <p>This resolver supports parameters annotated with {@link XPathParam @XPathParam} that specifies the XPath expression
|
||||
* <p>
|
||||
* This resolver supports parameters annotated with {@link XPathParam @XPathParam} that specifies the XPath expression
|
||||
* that should be bound to that parameter. The parameter can either a "natively supported" XPath type ({@link Boolean
|
||||
* boolean}, {@link Double double}, {@link String}, {@link Node}, or {@link NodeList}), or a type that is {@linkplain
|
||||
* ConversionService#canConvert(Class, Class) supported} by the {@link ConversionService}.
|
||||
* boolean}, {@link Double double}, {@link String}, {@link Node}, or {@link NodeList}), or a type that is
|
||||
* {@linkplain ConversionService#canConvert(Class, Class) supported} by the {@link ConversionService}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -60,9 +59,8 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
|
||||
|
||||
/**
|
||||
* Sets the conversion service to use.
|
||||
*
|
||||
* <p>Defaults to the {@linkplain ConversionServiceFactory#createDefaultConversionService() default conversion
|
||||
* service}.
|
||||
* <p>
|
||||
* Defaults to the {@linkplain ConversionServiceFactory#createDefaultConversionService() default conversion service}.
|
||||
*/
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
@@ -78,13 +76,11 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
|
||||
return false;
|
||||
}
|
||||
Class<?> parameterType = parameter.getParameterType();
|
||||
if (Boolean.class.equals(parameterType) || Boolean.TYPE.equals(parameterType) ||
|
||||
Double.class.equals(parameterType) || Double.TYPE.equals(parameterType) ||
|
||||
Node.class.isAssignableFrom(parameterType) || NodeList.class.isAssignableFrom(parameterType) ||
|
||||
String.class.isAssignableFrom(parameterType)) {
|
||||
if (Boolean.class.equals(parameterType) || Boolean.TYPE.equals(parameterType) || Double.class.equals(parameterType)
|
||||
|| Double.TYPE.equals(parameterType) || Node.class.isAssignableFrom(parameterType)
|
||||
|| NodeList.class.isAssignableFrom(parameterType) || String.class.isAssignableFrom(parameterType)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return conversionService.canConvert(String.class, parameterType);
|
||||
}
|
||||
}
|
||||
@@ -112,20 +108,15 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
|
||||
private QName getReturnType(Class<?> parameterType) {
|
||||
if (Boolean.class.equals(parameterType) || Boolean.TYPE.equals(parameterType)) {
|
||||
return XPathConstants.BOOLEAN;
|
||||
}
|
||||
else if (Double.class.equals(parameterType) || Double.TYPE.equals(parameterType)) {
|
||||
} else if (Double.class.equals(parameterType) || Double.TYPE.equals(parameterType)) {
|
||||
return XPathConstants.NUMBER;
|
||||
}
|
||||
else if (Node.class.equals(parameterType)) {
|
||||
} else if (Node.class.equals(parameterType)) {
|
||||
return XPathConstants.NODE;
|
||||
}
|
||||
else if (NodeList.class.equals(parameterType)) {
|
||||
} else if (NodeList.class.equals(parameterType)) {
|
||||
return XPathConstants.NODESET;
|
||||
}
|
||||
else if (String.class.equals(parameterType)) {
|
||||
} else if (String.class.equals(parameterType)) {
|
||||
return XPathConstants.STRING;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -145,9 +136,9 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
|
||||
|
||||
/**
|
||||
* Create a {@code XPathFactory} that this resolver will use to create {@link XPath} objects.
|
||||
*
|
||||
* <p>Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached,
|
||||
* so this method will only be called once.
|
||||
* <p>
|
||||
* Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so
|
||||
* this method will only be called once.
|
||||
*
|
||||
* @return the created factory
|
||||
*/
|
||||
@@ -155,5 +146,4 @@ public class XPathParamMethodArgumentResolver implements MethodArgumentResolver
|
||||
return XPathFactory.newInstance();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,14 +20,13 @@ import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.DOMReader;
|
||||
import org.dom4j.io.DocumentResult;
|
||||
import org.dom4j.io.DocumentSource;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver
|
||||
@@ -76,4 +75,4 @@ public class Dom4jPayloadMethodProcessor extends AbstractPayloadSourceMethodProc
|
||||
return Element.class.equals(parameter.getParameterType());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -48,8 +47,7 @@ public class DomPayloadMethodProcessor extends AbstractPayloadSourceMethodProces
|
||||
protected Node resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception {
|
||||
if (requestPayload instanceof DOMSource) {
|
||||
return resolveArgumentDomSource(parameter, (DOMSource) requestPayload);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
DOMResult domResult = new DOMResult();
|
||||
transform(requestPayload, domResult);
|
||||
DOMSource domSource = new DOMSource(domResult.getNode());
|
||||
@@ -62,8 +60,7 @@ public class DomPayloadMethodProcessor extends AbstractPayloadSourceMethodProces
|
||||
Node requestNode = requestSource.getNode();
|
||||
if (parameterType.isAssignableFrom(requestNode.getClass())) {
|
||||
return requestNode;
|
||||
}
|
||||
else if (Element.class.equals(parameterType) && requestNode instanceof Document) {
|
||||
} else if (Element.class.equals(parameterType) && requestNode instanceof Document) {
|
||||
Document document = (Document) requestNode;
|
||||
return document.getDocumentElement();
|
||||
}
|
||||
|
||||
@@ -19,14 +19,13 @@ package org.springframework.ws.server.endpoint.adapter.method.dom;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
|
||||
import org.jdom2.Document;
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.input.DOMBuilder;
|
||||
import org.jdom2.transform.JDOMResult;
|
||||
import org.jdom2.transform.JDOMSource;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
@@ -51,8 +50,7 @@ public class JDomPayloadMethodProcessor extends AbstractPayloadSourceMethodProce
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
return domBuilder.build((org.w3c.dom.Element) node);
|
||||
}
|
||||
else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
} else if (node.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
Document document = domBuilder.build((org.w3c.dom.Document) node);
|
||||
return document.getRootElement();
|
||||
}
|
||||
@@ -78,4 +76,4 @@ public class JDomPayloadMethodProcessor extends AbstractPayloadSourceMethodProce
|
||||
return Element.class.equals(parameter.getParameterType());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,15 @@
|
||||
|
||||
package org.springframework.ws.server.endpoint.adapter.method.dom;
|
||||
|
||||
import nu.xom.Builder;
|
||||
import nu.xom.Document;
|
||||
import nu.xom.Element;
|
||||
import nu.xom.ParsingException;
|
||||
import nu.xom.converters.DOMConverter;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@@ -25,16 +32,10 @@ import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import nu.xom.Builder;
|
||||
import nu.xom.Document;
|
||||
import nu.xom.Element;
|
||||
import nu.xom.ParsingException;
|
||||
import nu.xom.converters.DOMConverter;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
|
||||
import org.springframework.xml.DocumentBuilderFactoryUtils;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver
|
||||
@@ -60,8 +61,7 @@ public class XomPayloadMethodProcessor extends AbstractPayloadSourceMethodProces
|
||||
org.w3c.dom.Node node = ((DOMSource) requestPayload).getNode();
|
||||
if (node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
|
||||
return DOMConverter.convert((org.w3c.dom.Element) node);
|
||||
}
|
||||
else if (node.getNodeType() == org.w3c.dom.Node.DOCUMENT_NODE) {
|
||||
} else if (node.getNodeType() == org.w3c.dom.Node.DOCUMENT_NODE) {
|
||||
Document document = DOMConverter.convert((org.w3c.dom.Document) node);
|
||||
return document.getRootElement();
|
||||
}
|
||||
@@ -98,9 +98,9 @@ public class XomPayloadMethodProcessor extends AbstractPayloadSourceMethodProces
|
||||
|
||||
/**
|
||||
* Create a {@code DocumentBuilderFactory} that this resolver will use to create response payloads.
|
||||
*
|
||||
* <p>Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached,
|
||||
* so this method will only be called once.
|
||||
* <p>
|
||||
* Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so
|
||||
* this method will only be called once.
|
||||
*
|
||||
* @return the created factory
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.Writer;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
@@ -43,12 +44,6 @@ import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
@@ -57,6 +52,11 @@ import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadMeth
|
||||
import org.springframework.ws.stream.StreamingPayload;
|
||||
import org.springframework.ws.stream.StreamingWebServiceMessage;
|
||||
import org.springframework.xml.transform.TraxUtils;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver
|
||||
@@ -74,22 +74,22 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
private final ConcurrentMap<Class<?>, JAXBContext> jaxbContexts = new ConcurrentHashMap<Class<?>, JAXBContext>();
|
||||
|
||||
@Override
|
||||
public final void handleReturnValue(MessageContext messageContext,
|
||||
MethodParameter returnType, Object returnValue) throws Exception {
|
||||
public final void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
throws Exception {
|
||||
if (returnValue != null) {
|
||||
handleReturnValueInternal(messageContext, returnType, returnValue);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void handleReturnValueInternal(MessageContext messageContext,
|
||||
MethodParameter returnType, Object returnValue) throws Exception;
|
||||
protected abstract void handleReturnValueInternal(MessageContext messageContext, MethodParameter returnType,
|
||||
Object returnValue) throws Exception;
|
||||
|
||||
/**
|
||||
* Marshals the given {@code jaxbElement} to the response payload of the given message context.
|
||||
*
|
||||
* @param messageContext the message context to marshal to
|
||||
* @param clazz the clazz to create a marshaller for
|
||||
* @param jaxbElement the object to be marshalled
|
||||
* @param clazz the clazz to create a marshaller for
|
||||
* @param jaxbElement the object to be marshalled
|
||||
* @throws JAXBException in case of JAXB2 errors
|
||||
*/
|
||||
protected final void marshalToResponsePayload(MessageContext messageContext, Class<?> clazz, Object jaxbElement)
|
||||
@@ -106,14 +106,12 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
|
||||
StreamingPayload payload = new JaxbStreamingPayload(clazz, jaxbElement);
|
||||
streamingResponse.setStreamingPayload(payload);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Result responsePayload = response.getPayloadResult();
|
||||
try {
|
||||
Jaxb2ResultCallback callback = new Jaxb2ResultCallback(clazz, jaxbElement);
|
||||
TraxUtils.doWithResult(responsePayload, callback);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
throw convertToJaxbException(ex);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +121,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
* Unmarshals the request payload of the given message context.
|
||||
*
|
||||
* @param messageContext the message context to unmarshal from
|
||||
* @param clazz the class to unmarshal
|
||||
* @param clazz the class to unmarshal
|
||||
* @return the unmarshalled object, or {@code null} if the request has no payload
|
||||
* @throws JAXBException in case of JAXB2 errors
|
||||
*/
|
||||
@@ -140,8 +138,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
logger.debug("Unmarshalled payload request to [" + callback.result + "]");
|
||||
}
|
||||
return callback.result;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
throw convertToJaxbException(ex);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +147,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
* Unmarshals the request payload of the given message context as {@link JAXBElement}.
|
||||
*
|
||||
* @param messageContext the message context to unmarshal from
|
||||
* @param clazz the class to unmarshal
|
||||
* @param clazz the class to unmarshal
|
||||
* @return the unmarshalled element, or {@code null} if the request has no payload
|
||||
* @throws JAXBException in case of JAXB2 errors
|
||||
*/
|
||||
@@ -167,8 +164,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
logger.debug("Unmarshalled payload request to [" + callback.result + "]");
|
||||
}
|
||||
return callback.result;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
throw convertToJaxbException(ex);
|
||||
}
|
||||
}
|
||||
@@ -181,8 +177,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
private JAXBException convertToJaxbException(Exception ex) {
|
||||
if (ex instanceof JAXBException) {
|
||||
return (JAXBException) ex;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return new JAXBException(ex);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +216,6 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
return createUnmarshaller(getJaxbContext(clazz));
|
||||
}
|
||||
|
||||
|
||||
private JAXBContext getJaxbContext(Class<?> clazz) throws JAXBException {
|
||||
Assert.notNull(clazz, "'clazz' must not be null");
|
||||
JAXBContext jaxbContext = jaxbContexts.get(clazz);
|
||||
@@ -419,12 +413,10 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException {
|
||||
try {
|
||||
marshaller.marshal(jaxbElement, streamWriter);
|
||||
}
|
||||
catch (JAXBException ex) {
|
||||
} catch (JAXBException ex) {
|
||||
throw new XMLStreamException("Could not marshal [" + jaxbElement + "]: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ws.server.endpoint.adapter.method.jaxb;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
@@ -42,8 +43,7 @@ public class JaxbElementPayloadMethodProcessor extends AbstractJaxb2PayloadMetho
|
||||
}
|
||||
|
||||
@Override
|
||||
public JAXBElement<?> resolveArgument(MessageContext messageContext, MethodParameter parameter)
|
||||
throws JAXBException {
|
||||
public JAXBElement<?> resolveArgument(MessageContext messageContext, MethodParameter parameter) throws JAXBException {
|
||||
ParameterizedType parameterizedType = (ParameterizedType) parameter.getGenericParameterType();
|
||||
Class<?> clazz = (Class<?>) parameterizedType.getActualTypeArguments()[0];
|
||||
return unmarshalElementFromRequestPayload(messageContext, clazz);
|
||||
@@ -56,8 +56,8 @@ public class JaxbElementPayloadMethodProcessor extends AbstractJaxb2PayloadMetho
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleReturnValueInternal(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
throws JAXBException {
|
||||
protected void handleReturnValueInternal(MessageContext messageContext, MethodParameter returnType,
|
||||
Object returnValue) throws JAXBException {
|
||||
JAXBElement<?> element = (JAXBElement<?>) returnValue;
|
||||
marshalToResponsePayload(messageContext, element.getDeclaredType(), element);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.springframework.ws.context.MessageContext;
|
||||
/**
|
||||
* Implementation of {@link org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver
|
||||
* MethodArgumentResolver} and {@link org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler
|
||||
* MethodReturnValueHandler} that supports parameters annotated with {@link XmlRootElement @XmlRootElement} or {@link
|
||||
* XmlType @XmlType}, and return values annotated with {@link XmlRootElement @XmlRootElement}.
|
||||
* MethodReturnValueHandler} that supports parameters annotated with {@link XmlRootElement @XmlRootElement} or
|
||||
* {@link XmlType @XmlType}, and return values annotated with {@link XmlRootElement @XmlRootElement}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 2.0
|
||||
@@ -38,8 +38,7 @@ public class XmlRootElementPayloadMethodProcessor extends AbstractJaxb2PayloadMe
|
||||
@Override
|
||||
protected boolean supportsRequestPayloadParameter(MethodParameter parameter) {
|
||||
Class<?> parameterType = parameter.getParameterType();
|
||||
return parameterType.isAnnotationPresent(XmlRootElement.class) ||
|
||||
parameterType.isAnnotationPresent(XmlType.class);
|
||||
return parameterType.isAnnotationPresent(XmlRootElement.class) || parameterType.isAnnotationPresent(XmlType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,8 +47,7 @@ public class XmlRootElementPayloadMethodProcessor extends AbstractJaxb2PayloadMe
|
||||
|
||||
if (parameterType.isAnnotationPresent(XmlRootElement.class)) {
|
||||
return unmarshalFromRequestPayload(messageContext, parameterType);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
JAXBElement<?> element = unmarshalElementFromRequestPayload(messageContext, parameterType);
|
||||
return element != null ? element.getValue() : null;
|
||||
}
|
||||
@@ -62,11 +60,10 @@ public class XmlRootElementPayloadMethodProcessor extends AbstractJaxb2PayloadMe
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleReturnValueInternal(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
throws JAXBException {
|
||||
protected void handleReturnValueInternal(MessageContext messageContext, MethodParameter returnType,
|
||||
Object returnValue) throws JAXBException {
|
||||
Class<?> parameterType = returnType.getParameterType();
|
||||
marshalToResponsePayload(messageContext, parameterType, returnValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Provides the <code>MethodArgumentResolver</code> and <code>MethodReturnValueHandler</code> abstractions, and various
|
||||
Provides the <code>MethodArgumentResolver</code> and <code>MethodReturnValueHandler</code> abstractions, and various
|
||||
implementations thereof.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -28,10 +28,11 @@ import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationM
|
||||
|
||||
/**
|
||||
* Indicates that an annotated class is an "Endpoint" (e.g. a web service endpoint).
|
||||
*
|
||||
* <p>This annotation serves as a specialization of {@link Component @Component}, allowing for implementation classes to be
|
||||
* autodetected through classpath scanning. Instances of this class are typically picked up by an {@link
|
||||
* AbstractAnnotationMethodEndpointMapping} implementation, such as {@link SoapActionAnnotationMethodEndpointMapping}.
|
||||
* <p>
|
||||
* This annotation serves as a specialization of {@link Component @Component}, allowing for implementation classes to be
|
||||
* autodetected through classpath scanning. Instances of this class are typically picked up by an
|
||||
* {@link AbstractAnnotationMethodEndpointMapping} implementation, such as
|
||||
* {@link SoapActionAnnotationMethodEndpointMapping}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.context.annotation.ClassPathBeanDefinitionScanner
|
||||
|
||||
@@ -21,12 +21,13 @@ import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
|
||||
/**
|
||||
* Sets up a namespace to be used in an {@link Endpoint @Endpoint} method, class, or package.
|
||||
*
|
||||
* <p>Typically used in combination with {@link XPathParam @XPathParam}, or {@link PayloadRoot @PayloadRoot}.
|
||||
* <p>
|
||||
* Typically used in combination with {@link XPathParam @XPathParam}, or {@link PayloadRoot @PayloadRoot}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see XPathParam
|
||||
@@ -35,7 +36,7 @@ import javax.xml.XMLConstants;
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD})
|
||||
@Target({ ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD })
|
||||
public @interface Namespace {
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD})
|
||||
@Target({ ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD })
|
||||
public @interface Namespaces {
|
||||
|
||||
Namespace[] value();
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Marks an endpoint method as the handler for an incoming request. The annotation values signify the request
|
||||
* payload root element that is handled by the method.
|
||||
* Marks an endpoint method as the handler for an incoming request. The annotation values signify the request payload
|
||||
* root element that is handled by the method.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation which indicates that a method parameter should be bound to the {@linkplain
|
||||
* org.springframework.ws.WebServiceMessage#getPayloadSource() request payload}. Supported for annotated endpoint
|
||||
* methods.
|
||||
* Annotation which indicates that a method parameter should be bound to the
|
||||
* {@linkplain org.springframework.ws.WebServiceMessage#getPayloadSource() request payload}. Supported for annotated
|
||||
* endpoint methods.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see ResponsePayload
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation which indicates that a method return value should be bound to the {@linkplain
|
||||
* org.springframework.ws.WebServiceMessage#getPayloadSource() response payload}. Supported for annotated endpoint
|
||||
* methods.
|
||||
* Annotation which indicates that a method return value should be bound to the
|
||||
* {@linkplain org.springframework.ws.WebServiceMessage#getPayloadSource() response payload}. Supported for annotated
|
||||
* endpoint methods.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see RequestPayload
|
||||
|
||||
@@ -24,9 +24,14 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicates that a method parameter should be bound to an XPath expression. The annotation value signifies the XPath
|
||||
* expression to use. The parameter can be of the following types: <ul> <li>{@code boolean}, or {@link
|
||||
* Boolean}</li> <li>{@code double}, or {@link Double}</li> <li>{@link String}</li> <li>{@link
|
||||
* org.w3c.dom.Node}</li> <li>{@link org.w3c.dom.NodeList}</li> </ul>
|
||||
* expression to use. The parameter can be of the following types:
|
||||
* <ul>
|
||||
* <li>{@code boolean}, or {@link Boolean}</li>
|
||||
* <li>{@code double}, or {@link Double}</li>
|
||||
* <li>{@link String}</li>
|
||||
* <li>{@link org.w3c.dom.Node}</li>
|
||||
* <li>{@link org.w3c.dom.NodeList}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user