diff --git a/spring-ws-core/build.gradle b/spring-ws-core/build.gradle index 9281aa28..de65ab67 100644 --- a/spring-ws-core/build.gradle +++ b/spring-ws-core/build.gradle @@ -17,9 +17,6 @@ dependencies { api("org.springframework:spring-web") api("org.springframework:spring-webmvc") - optional("commons-httpclient:commons-httpclient") { - exclude(group: "commons-logging", module: "commons-logging") - } optional("jakarta.mail:jakarta.mail-api") optional("jakarta.servlet:jakarta.servlet-api") optional("org.apache.httpcomponents:httpclient") { diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/FaultAwareWebServiceConnection.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/FaultAwareWebServiceConnection.java index dff387a3..6aab5e31 100644 --- a/spring-ws-core/src/main/java/org/springframework/ws/transport/FaultAwareWebServiceConnection.java +++ b/spring-ws-core/src/main/java/org/springframework/ws/transport/FaultAwareWebServiceConnection.java @@ -42,17 +42,6 @@ public interface FaultAwareWebServiceConnection extends WebServiceConnection { */ boolean hasFault() throws IOException; - /** - * Sets whether this connection will send a fault. - *
- * Typically implemented by setting an HTTP status code. - * @param fault {@code true} if this will send a fault; {@code false} otherwise. - * @throws IOException in case of I/O errors - * @deprecated In favor of {@link #setFaultCode(QName)} - */ - @Deprecated - void setFault(boolean fault) throws IOException; - /** * Sets a specific fault code. *
diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/AbstractHttpSenderConnection.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/AbstractHttpSenderConnection.java
index 1c3d973a..ac41873a 100644
--- a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/AbstractHttpSenderConnection.java
+++ b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/AbstractHttpSenderConnection.java
@@ -167,11 +167,6 @@ public abstract class AbstractHttpSenderConnection extends AbstractSenderConnect
return false;
}
- @Override
- @Deprecated
- public final void setFault(boolean fault) {
- }
-
@Override
public final void setFaultCode(QName faultCode) throws IOException {
}
diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/CommonsHttpConnection.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/CommonsHttpConnection.java
deleted file mode 100644
index 24b00be5..00000000
--- a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/CommonsHttpConnection.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright 2005-2025 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.ws.transport.http;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.URIException;
-import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
-import org.apache.commons.httpclient.methods.PostMethod;
-
-import org.springframework.util.Assert;
-import org.springframework.ws.WebServiceMessage;
-import org.springframework.ws.transport.WebServiceConnection;
-
-/**
- * Implementation of {@link WebServiceConnection} that is based on Jakarta Commons
- * HttpClient. Exposes a {@link PostMethod}.
- *
- * @author Arjen Poutsma
- * @author Greg Turnquist
- * @since 1.0.0
- * @deprecated In favor of {@link HttpComponentsConnection}
- */
-@Deprecated
-public class CommonsHttpConnection extends AbstractHttpSenderConnection {
-
- private final HttpClient httpClient;
-
- private final PostMethod postMethod;
-
- private ByteArrayOutputStream requestBuffer;
-
- private MultiThreadedHttpConnectionManager connectionManager;
-
- protected CommonsHttpConnection(HttpClient httpClient, PostMethod postMethod) {
- Assert.notNull(httpClient, "httpClient must not be null");
- Assert.notNull(postMethod, "postMethod must not be null");
- this.httpClient = httpClient;
- this.postMethod = postMethod;
- }
-
- public PostMethod getPostMethod() {
- return this.postMethod;
- }
-
- @Override
- public void onClose() throws IOException {
- this.postMethod.releaseConnection();
- if (this.connectionManager != null) {
- this.connectionManager.shutdown();
- }
- }
-
- /*
- * URI
- */
-
- @Override
- public URI getUri() throws URISyntaxException {
- try {
- return new URI(this.postMethod.getURI().toString());
- }
- catch (URIException ex) {
- throw new URISyntaxException("", ex.getMessage());
- }
- }
-
- /*
- * Sending request
- */
-
- @Override
- protected void onSendBeforeWrite(WebServiceMessage message) throws IOException {
- this.requestBuffer = new ByteArrayOutputStream();
- }
-
- @Override
- public void addRequestHeader(String name, String value) throws IOException {
- this.postMethod.addRequestHeader(name, value);
- }
-
- @Override
- protected OutputStream getRequestOutputStream() throws IOException {
- return this.requestBuffer;
- }
-
- @Override
- protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
- this.postMethod.setRequestEntity(new ByteArrayRequestEntity(this.requestBuffer.toByteArray()));
- this.requestBuffer = null;
- try {
- this.httpClient.executeMethod(this.postMethod);
- }
- catch (IllegalStateException ex) {
- if ("Connection factory has been shutdown.".equals(ex.getMessage())) {
- // The application context has been closed, resulting in a connection
- // factory shutdown and an ISE.
- // Let's create a new connection factory for this connection only.
- this.connectionManager = new MultiThreadedHttpConnectionManager();
- this.httpClient.setHttpConnectionManager(this.connectionManager);
- this.httpClient.executeMethod(this.postMethod);
- }
- else {
- throw ex;
- }
- }
- }
-
- /*
- * Receiving response
- */
-
- @Override
- protected int getResponseCode() throws IOException {
- return this.postMethod.getStatusCode();
- }
-
- @Override
- protected String getResponseMessage() throws IOException {
- return this.postMethod.getStatusText();
- }
-
- @Override
- protected long getResponseContentLength() throws IOException {
- return this.postMethod.getResponseContentLength();
- }
-
- @Override
- protected InputStream getRawResponseInputStream() throws IOException {
- return this.postMethod.getResponseBodyAsStream();
- }
-
- @Override
- public Iterator
- * Allows to use a preconfigured HttpClient instance, potentially with authentication,
- * HTTP connection pooling, etc. Authentication can also be set by injecting a
- * {@link Credentials} instance (such as the {@link UsernamePasswordCredentials}).
- *
- * @author Arjen Poutsma
- * @since 1.0.0
- * @see HttpUrlConnectionMessageSender
- * @see HttpClient
- * @see #setCredentials(Credentials)
- * @deprecated In favor of {@link HttpComponents5MessageSender}
- */
-@Deprecated
-public class CommonsHttpMessageSender extends AbstractHttpWebServiceMessageSender
- implements InitializingBean, DisposableBean {
-
- private static final int DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS = (60 * 1000);
-
- private static final int DEFAULT_READ_TIMEOUT_MILLISECONDS = (60 * 1000);
-
- private HttpClient httpClient;
-
- private Credentials credentials;
-
- private AuthScope authScope;
-
- /**
- * Create a new instance of the {@code CommonsHttpMessageSender} with a default
- * {@link HttpClient} that uses a default {@link MultiThreadedHttpConnectionManager}.
- */
- public CommonsHttpMessageSender() {
- this.httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
- setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS);
- setReadTimeout(DEFAULT_READ_TIMEOUT_MILLISECONDS);
- }
-
- /**
- * Create a new instance of the {@code CommonsHttpMessageSender} with the given
- * {@link HttpClient} instance.
- * @param httpClient the HttpClient instance to use for this sender
- */
- public CommonsHttpMessageSender(HttpClient httpClient) {
- Assert.notNull(httpClient, "httpClient must not be null");
- this.httpClient = httpClient;
- }
-
- /** Returns the {@code HttpClient} used by this message sender. */
- public HttpClient getHttpClient() {
- return this.httpClient;
- }
-
- /** Set the {@code HttpClient} used by this message sender. */
- public void setHttpClient(HttpClient httpClient) {
- this.httpClient = httpClient;
- }
-
- /** Returns the credentials to be used. */
- public Credentials getCredentials() {
- return this.credentials;
- }
-
- /**
- * Sets the credentials to be used. If not set, no authentication is done.
- * @see UsernamePasswordCredentials
- * @see NTCredentials
- */
- public void setCredentials(Credentials credentials) {
- this.credentials = credentials;
- }
-
- /**
- * Sets the timeout until a connection is etablished. A value of 0 means
- * never timeout.
- * @param timeout the timeout value in milliseconds
- * @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setConnectionTimeout(int)
- */
- public void setConnectionTimeout(int timeout) {
- if (timeout < 0) {
- throw new IllegalArgumentException("timeout must be a non-negative value");
- }
- getHttpClient().getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
- }
-
- /**
- * Set the socket read timeout for the underlying HttpClient. A value of 0 means
- * never timeout.
- * @param timeout the timeout value in milliseconds
- * @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setSoTimeout(int)
- */
- public void setReadTimeout(int timeout) {
- if (timeout < 0) {
- throw new IllegalArgumentException("timeout must be a non-negative value");
- }
- getHttpClient().getHttpConnectionManager().getParams().setSoTimeout(timeout);
- }
-
- /**
- * Sets the maximum number of connections allowed for the underlying HttpClient.
- * @param maxTotalConnections the maximum number of connections allowed
- * @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setMaxTotalConnections(int)
- */
- public void setMaxTotalConnections(int maxTotalConnections) {
- if (maxTotalConnections <= 0) {
- throw new IllegalArgumentException("maxTotalConnections must be a positive value");
- }
- getHttpClient().getHttpConnectionManager().getParams().setMaxTotalConnections(maxTotalConnections);
- }
-
- /**
- * Sets the maximum number of connections per host for the underlying HttpClient. The
- * maximum number of connections per host can be set in a form accepted by the
- * {@code java.util.Properties} class, like as follows:
- *
- *
- * By default, the {@link AuthScope#ANY} is returned.
- */
- public AuthScope getAuthScope() {
- return (this.authScope != null) ? this.authScope : AuthScope.ANY;
- }
-
- /**
- * Sets the authentication scope to be used. Only used when the {@code credentials}
- * property has been set.
- *
- * By default, the {@link AuthScope#ANY} is used.
- * @see #setCredentials(Credentials)
- */
- public void setAuthScope(AuthScope authScope) {
- this.authScope = authScope;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception {
- if (getCredentials() != null) {
- getHttpClient().getState().setCredentials(getAuthScope(), getCredentials());
- getHttpClient().getParams().setAuthenticationPreemptive(true);
- }
- }
-
- @Override
- public void destroy() throws Exception {
- HttpConnectionManager connectionManager = getHttpClient().getHttpConnectionManager();
- if (connectionManager instanceof MultiThreadedHttpConnectionManager) {
- ((MultiThreadedHttpConnectionManager) connectionManager).shutdown();
- }
- }
-
- @Override
- public WebServiceConnection createConnection(URI uri) throws IOException {
- PostMethod postMethod = new PostMethod(uri.toString());
- if (isAcceptGzipEncoding()) {
- postMethod.addRequestHeader(HttpTransportConstants.HEADER_ACCEPT_ENCODING,
- HttpTransportConstants.CONTENT_ENCODING_GZIP);
- }
- return new CommonsHttpConnection(getHttpClient(), postMethod);
- }
-
-}
diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpServletConnection.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpServletConnection.java
index ce0aeb39..92699e94 100644
--- a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpServletConnection.java
+++ b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpServletConnection.java
@@ -156,18 +156,6 @@ public class HttpServletConnection extends AbstractReceiverConnection
return false;
}
- @Override
- @Deprecated
- public void setFault(boolean fault) throws IOException {
- if (fault) {
- getHttpServletResponse().setStatus(HttpTransportConstants.STATUS_INTERNAL_SERVER_ERROR);
- }
- else {
- getHttpServletResponse().setStatus(HttpTransportConstants.STATUS_OK);
- }
- this.statusCodeSet = true;
- }
-
@Override
public void setFaultCode(QName faultCode) throws IOException {
if (faultCode != null) {
diff --git a/spring-ws-core/src/test/java/org/springframework/ws/transport/http/CommonsHttpMessageSenderIntegrationTest.java b/spring-ws-core/src/test/java/org/springframework/ws/transport/http/CommonsHttpMessageSenderIntegrationTest.java
deleted file mode 100644
index 93c9d74c..00000000
--- a/spring-ws-core/src/test/java/org/springframework/ws/transport/http/CommonsHttpMessageSenderIntegrationTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2005-2025 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.ws.transport.http;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import jakarta.servlet.http.HttpServlet;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.xml.soap.MessageFactory;
-import org.apache.commons.httpclient.URIException;
-import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.context.support.StaticApplicationContext;
-import org.springframework.util.FileCopyUtils;
-import org.springframework.ws.soap.saaj.SaajSoapMessage;
-import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
-import org.springframework.ws.transport.WebServiceConnection;
-import org.springframework.ws.transport.support.FreePortScanner;
-
-@Deprecated
-public class CommonsHttpMessageSenderIntegrationTest
- extends AbstractHttpWebServiceMessageSenderIntegrationTest
- * Migrated from Spring Security 2 since it has been removed in Spring Security 3.
- *
- * https://www.example.com=1
- * http://www.example.com:8080=7
- * www.springframework.org=10
- * *=5
- *
- *
- * The host can be specified as hostname, or as URI (with scheme and port). The
- * special host name {@code *} can be used to specify
- * {@link org.apache.commons.httpclient.HostConfiguration#ANY_HOST_CONFIGURATION}.
- * @param maxConnectionsPerHost a properties object specifying the maximum number of
- * connection
- * @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setMaxConnectionsPerHost(org.apache.commons.httpclient.HostConfiguration,
- * int)
- */
- public void setMaxConnectionsPerHost(Map