From b3964b7916ff9e79093dfa8d76ee6120e5598d27 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Mon, 3 Feb 2014 12:50:09 +0100 Subject: [PATCH] Added template method for NoEndpointFoundException Introduced handleNoEndpointFoundException to allow for customization in subclasses. Issue: SWS-850 --- ...ebServiceMessageReceiverObjectSupport.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/support/WebServiceMessageReceiverObjectSupport.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/support/WebServiceMessageReceiverObjectSupport.java index d0a859ac..e465ad69 100644 --- a/spring-ws-core/src/main/java/org/springframework/ws/transport/support/WebServiceMessageReceiverObjectSupport.java +++ b/spring-ws-core/src/main/java/org/springframework/ws/transport/support/WebServiceMessageReceiverObjectSupport.java @@ -98,9 +98,7 @@ public abstract class WebServiceMessageReceiverObjectSupport implements Initiali } } catch (NoEndpointFoundException ex) { - if (connection instanceof EndpointAwareWebServiceConnection) { - ((EndpointAwareWebServiceConnection) connection).endpointNotFound(); - } + handleNoEndpointFoundException(ex, connection, receiver); } finally { TransportUtils.closeConnection(connection); @@ -108,7 +106,27 @@ public abstract class WebServiceMessageReceiverObjectSupport implements Initiali } } - private void logUri(WebServiceConnection connection) { + /** + * Template method for handling {@code NoEndpointFoundException}s. + *

+ * Default implementation calls + * {@link EndpointAwareWebServiceConnection#endpointNotFound()} on the given + * connection, if possible. + * + * @param ex the {@code NoEndpointFoundException} + * @param connection the current {@code WebServiceConnection} + * @param receiver the {@code WebServiceMessageReceiver} + * @throws Exception in case of errors + */ + protected void handleNoEndpointFoundException(NoEndpointFoundException ex, + WebServiceConnection connection, + WebServiceMessageReceiver receiver) throws Exception { + if (connection instanceof EndpointAwareWebServiceConnection) { + ((EndpointAwareWebServiceConnection) connection).endpointNotFound(); + } + } + + private void logUri(WebServiceConnection connection) { if (logger.isDebugEnabled()) { try { logger.debug("Accepting incoming [" + connection + "] at [" + connection.getUri() + "]");