diff --git a/README.md b/README.md
index f076adcd1101..6cb726f2a4ec 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,8 @@
-# Spring Framework [](https://github.com/spring-projects/spring-framework/actions/workflows/build-and-deploy-snapshot.yml?query=branch%3A5.3.x) [](https://ge.spring.io/scans?search.rootProjectNames=spring)
+# wso2-spring-framework
+
+This is a fork of spring-projects/spring-framework repository which is forked at the tag 5.3.39.
+
+#
Spring Framework [](https://github.com/spring-projects/spring-framework/actions/workflows/build-and-deploy-snapshot.yml?query=branch%3A5.3.x) [](https://ge.spring.io/scans?search.rootProjectNames=spring)
This is the home of the Spring Framework: the foundation for all [Spring projects](https://spring.io/projects). Collectively the Spring Framework and the family of Spring projects are often referred to simply as "Spring".
diff --git a/build.gradle b/build.gradle
index a0d87c6514ed..1d244c529ce2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -441,5 +441,12 @@ configure(rootProject) {
}
}
}
+}
+
+tasks.named('build').configure {
+ finalizedBy('publishToMavenLocal')
+}
+tasks.named('publish').configure {
+ dependsOn('build')
}
diff --git a/gradle.properties b/gradle.properties
index 9e3e10227a86..ff8254b7bf04 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-version=5.3.39
+version=5.3.39-wso2v1
org.gradle.jvmargs=-Xmx2048m
org.gradle.caching=true
org.gradle.parallel=true
diff --git a/gradle/spring-module.gradle b/gradle/spring-module.gradle
index 7628127cb5d4..8f1a17aa5084 100644
--- a/gradle/spring-module.gradle
+++ b/gradle/spring-module.gradle
@@ -95,8 +95,29 @@ publishing {
artifact javadocJar
}
}
+
+ repositories {
+ maven {
+ name 'nexus'
+ url = System.getenv("NEXUS_REPO_URL") ? System.getenv("NEXUS_REPO_URL") :
+ "https://maven.wso2.org/nexus/content/repositories/releases"
+ credentials {
+ username rootProject.hasProperty("nexus_username") ? nexus_username : System.getenv("NEXUS_USERNAME")
+ password rootProject.hasProperty("nexus_password") ? nexus_password : System.getenv("NEXUS_PASSWORD")
+ }
+ allowInsecureProtocol = false
+ }
+ }
}
// Disable publication of test fixture artifacts.
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
+
+tasks.named('build').configure {
+ finalizedBy('publishToMavenLocal')
+}
+
+tasks.named('publish').configure {
+ dependsOn('build')
+}
diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java b/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java
index 9c897b8a7641..50f786d72747 100644
--- a/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java
+++ b/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java
@@ -48,7 +48,6 @@
* @author Juergen Hoeller
* @since 1.1.3
* @see java.rmi.server.RMIClassLoader
- * @see RemoteInvocationSerializingExporter#createObjectInputStream
* @see org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor#setCodebaseUrl
* @deprecated as of 5.3 (phasing out serialization-based remoting)
*/
diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java
deleted file mode 100644
index 99e81a4e27cf..000000000000
--- a/spring-context/src/main/java/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2002-2018 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.remoting.rmi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.rmi.RemoteException;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.remoting.support.RemoteInvocation;
-import org.springframework.remoting.support.RemoteInvocationBasedExporter;
-import org.springframework.remoting.support.RemoteInvocationResult;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-
-/**
- * Abstract base class for remote service exporters that explicitly deserialize
- * {@link org.springframework.remoting.support.RemoteInvocation} objects and serialize
- * {@link org.springframework.remoting.support.RemoteInvocationResult} objects,
- * for example Spring's HTTP invoker.
- *
- *
Provides template methods for {@code ObjectInputStream} and - * {@code ObjectOutputStream} handling. - * - * @author Juergen Hoeller - * @since 2.5.1 - * @see java.io.ObjectInputStream - * @see java.io.ObjectOutputStream - * @see #doReadRemoteInvocation - * @see #doWriteRemoteInvocationResult - * @deprecated as of 5.3 (phasing out serialization-based remoting) - */ -@Deprecated -public abstract class RemoteInvocationSerializingExporter extends RemoteInvocationBasedExporter - implements InitializingBean { - - /** - * Default content type: "application/x-java-serialized-object". - */ - public static final String CONTENT_TYPE_SERIALIZED_OBJECT = "application/x-java-serialized-object"; - - - private String contentType = CONTENT_TYPE_SERIALIZED_OBJECT; - - private boolean acceptProxyClasses = true; - - private Object proxy; - - - /** - * Specify the content type to use for sending remote invocation responses. - *
Default is "application/x-java-serialized-object". - */ - public void setContentType(String contentType) { - Assert.notNull(contentType, "'contentType' must not be null"); - this.contentType = contentType; - } - - /** - * Return the content type to use for sending remote invocation responses. - */ - public String getContentType() { - return this.contentType; - } - - /** - * Set whether to accept deserialization of proxy classes. - *
Default is "true". May be deactivated as a security measure. - */ - public void setAcceptProxyClasses(boolean acceptProxyClasses) { - this.acceptProxyClasses = acceptProxyClasses; - } - - /** - * Return whether to accept deserialization of proxy classes. - */ - public boolean isAcceptProxyClasses() { - return this.acceptProxyClasses; - } - - - @Override - public void afterPropertiesSet() { - prepare(); - } - - /** - * Initialize this service exporter. - */ - public void prepare() { - this.proxy = getProxyForService(); - } - - protected final Object getProxy() { - if (this.proxy == null) { - throw new IllegalStateException(ClassUtils.getShortName(getClass()) + " has not been initialized"); - } - return this.proxy; - } - - - /** - * Create an ObjectInputStream for the given InputStream. - *
The default implementation creates a Spring {@link CodebaseAwareObjectInputStream}. - * @param is the InputStream to read from - * @return the new ObjectInputStream instance to use - * @throws java.io.IOException if creation of the ObjectInputStream failed - */ - protected ObjectInputStream createObjectInputStream(InputStream is) throws IOException { - return new CodebaseAwareObjectInputStream(is, getBeanClassLoader(), isAcceptProxyClasses()); - } - - /** - * Perform the actual reading of an invocation result object from the - * given ObjectInputStream. - *
The default implementation simply calls - * {@link java.io.ObjectInputStream#readObject()}. - * Can be overridden for deserialization of a custom wrapper object rather - * than the plain invocation, for example an encryption-aware holder. - * @param ois the ObjectInputStream to read from - * @return the RemoteInvocationResult object - * @throws java.io.IOException in case of I/O failure - * @throws ClassNotFoundException if case of a transferred class not - * being found in the local ClassLoader - */ - protected RemoteInvocation doReadRemoteInvocation(ObjectInputStream ois) - throws IOException, ClassNotFoundException { - - Object obj = ois.readObject(); - if (!(obj instanceof RemoteInvocation)) { - throw new RemoteException("Deserialized object needs to be assignable to type [" + - RemoteInvocation.class.getName() + "]: " + ClassUtils.getDescriptiveType(obj)); - } - return (RemoteInvocation) obj; - } - - /** - * Create an ObjectOutputStream for the given OutputStream. - *
The default implementation creates a plain - * {@link java.io.ObjectOutputStream}. - * @param os the OutputStream to write to - * @return the new ObjectOutputStream instance to use - * @throws java.io.IOException if creation of the ObjectOutputStream failed - */ - protected ObjectOutputStream createObjectOutputStream(OutputStream os) throws IOException { - return new ObjectOutputStream(os); - } - - /** - * Perform the actual writing of the given invocation result object - * to the given ObjectOutputStream. - *
The default implementation simply calls - * {@link java.io.ObjectOutputStream#writeObject}. - * Can be overridden for serialization of a custom wrapper object rather - * than the plain invocation, for example an encryption-aware holder. - * @param result the RemoteInvocationResult object - * @param oos the ObjectOutputStream to write to - * @throws java.io.IOException if thrown by I/O methods - */ - protected void doWriteRemoteInvocationResult(RemoteInvocationResult result, ObjectOutputStream oos) - throws IOException { - - oos.writeObject(result); - } - -} diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java index 9ee3a6c112bf..741d23d97b6f 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java @@ -64,7 +64,6 @@ * @see java.rmi.Remote * @see java.rmi.RemoteException * @see org.springframework.remoting.caucho.HessianServiceExporter - * @see org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter * @deprecated as of 5.3 (phasing out serialization-based remoting) */ @Deprecated diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java index fec43c6bb209..371c4e2918c0 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java @@ -45,7 +45,6 @@ * @see org.springframework.remoting.rmi.RmiProxyFactoryBean * @see org.springframework.remoting.rmi.RmiServiceExporter * @see org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean - * @see org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter */ public class RemoteInvocation implements Serializable { diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationExecutor.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationExecutor.java index 02d456b3a4be..89ab71d5a84d 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationExecutor.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationExecutor.java @@ -21,14 +21,12 @@ /** * Strategy interface for executing a {@link RemoteInvocation} on a target object. * - *
Used by {@link org.springframework.remoting.rmi.RmiServiceExporter} (for RMI invokers) - * and by {@link org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter}. + *
Used by {@link org.springframework.remoting.rmi.RmiServiceExporter} (for RMI invokers).
*
* @author Juergen Hoeller
* @since 1.1
* @see DefaultRemoteInvocationFactory
* @see org.springframework.remoting.rmi.RmiServiceExporter#setRemoteInvocationExecutor
- * @see org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter#setRemoteInvocationExecutor
*/
public interface RemoteInvocationExecutor {
diff --git a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java
index f72fb9fdba8e..aa9a9f235150 100644
--- a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java
+++ b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java
@@ -121,7 +121,6 @@ public void setExecutor(Executor executor) {
* for specific context paths.
* @param contexts a Map with context paths as keys and HttpHandler
* objects as values
- * @see org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter
* @see org.springframework.remoting.caucho.SimpleHessianServiceExporter
*/
public void setContexts(Map Deserializes remote invocation objects and serializes remote invocation
- * result objects. Uses Java serialization just like RMI, but provides the
- * same ease of setup as Caucho's HTTP-based Hessian protocol.
- *
- * HTTP invoker is the recommended protocol for Java-to-Java remoting.
- * It is more powerful and more extensible than Hessian, at the expense of
- * being tied to Java. Nevertheless, it is as easy to set up as Hessian,
- * which is its main advantage compared to RMI.
- *
- * WARNING: Be aware of vulnerabilities due to unsafe Java deserialization:
- * Manipulated input streams could lead to unwanted code execution on the server
- * during the deserialization step. As a consequence, do not expose HTTP invoker
- * endpoints to untrusted clients but rather just between your own services.
- * In general, we strongly recommend any other message format (e.g. JSON) instead.
- *
- * @author Juergen Hoeller
- * @since 1.1
- * @see HttpInvokerClientInterceptor
- * @see HttpInvokerProxyFactoryBean
- * @see org.springframework.remoting.rmi.RmiServiceExporter
- * @see org.springframework.remoting.caucho.HessianServiceExporter
- * @deprecated as of 5.3 (phasing out serialization-based remoting)
- */
-@Deprecated
-public class HttpInvokerServiceExporter extends org.springframework.remoting.rmi.RemoteInvocationSerializingExporter implements HttpRequestHandler {
-
- /**
- * Reads a remote invocation from the request, executes it,
- * and writes the remote invocation result to the response.
- * @see #readRemoteInvocation(HttpServletRequest)
- * @see #invokeAndCreateResult(org.springframework.remoting.support.RemoteInvocation, Object)
- * @see #writeRemoteInvocationResult(HttpServletRequest, HttpServletResponse, RemoteInvocationResult)
- */
- @Override
- public void handleRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- try {
- RemoteInvocation invocation = readRemoteInvocation(request);
- RemoteInvocationResult result = invokeAndCreateResult(invocation, getProxy());
- writeRemoteInvocationResult(request, response, result);
- }
- catch (ClassNotFoundException ex) {
- throw new NestedServletException("Class not found during deserialization", ex);
- }
- }
-
- /**
- * Read a RemoteInvocation from the given HTTP request.
- * Delegates to {@link #readRemoteInvocation(HttpServletRequest, InputStream)} with
- * the {@link HttpServletRequest#getInputStream() servlet request's input stream}.
- * @param request current HTTP request
- * @return the RemoteInvocation object
- * @throws IOException in case of I/O failure
- * @throws ClassNotFoundException if thrown by deserialization
- */
- protected RemoteInvocation readRemoteInvocation(HttpServletRequest request)
- throws IOException, ClassNotFoundException {
-
- return readRemoteInvocation(request, request.getInputStream());
- }
-
- /**
- * Deserialize a RemoteInvocation object from the given InputStream.
- * Gives {@link #decorateInputStream} a chance to decorate the stream
- * first (for example, for custom encryption or compression). Creates a
- * {@link org.springframework.remoting.rmi.CodebaseAwareObjectInputStream}
- * and calls {@link #doReadRemoteInvocation} to actually read the object.
- * Can be overridden for custom serialization of the invocation.
- * @param request current HTTP request
- * @param is the InputStream to read from
- * @return the RemoteInvocation object
- * @throws IOException in case of I/O failure
- * @throws ClassNotFoundException if thrown during deserialization
- */
- protected RemoteInvocation readRemoteInvocation(HttpServletRequest request, InputStream is)
- throws IOException, ClassNotFoundException {
-
- try (ObjectInputStream ois = createObjectInputStream(decorateInputStream(request, is))) {
- return doReadRemoteInvocation(ois);
- }
- }
-
- /**
- * Return the InputStream to use for reading remote invocations,
- * potentially decorating the given original InputStream.
- * The default implementation returns the given stream as-is.
- * Can be overridden, for example, for custom encryption or compression.
- * @param request current HTTP request
- * @param is the original InputStream
- * @return the potentially decorated InputStream
- * @throws IOException in case of I/O failure
- */
- protected InputStream decorateInputStream(HttpServletRequest request, InputStream is) throws IOException {
- return is;
- }
-
- /**
- * Write the given RemoteInvocationResult to the given HTTP response.
- * @param request current HTTP request
- * @param response current HTTP response
- * @param result the RemoteInvocationResult object
- * @throws IOException in case of I/O failure
- */
- protected void writeRemoteInvocationResult(
- HttpServletRequest request, HttpServletResponse response, RemoteInvocationResult result)
- throws IOException {
-
- response.setContentType(getContentType());
- writeRemoteInvocationResult(request, response, result, response.getOutputStream());
- }
-
- /**
- * Serialize the given RemoteInvocation to the given OutputStream.
- * The default implementation gives {@link #decorateOutputStream} a chance
- * to decorate the stream first (for example, for custom encryption or compression).
- * Creates an {@link java.io.ObjectOutputStream} for the final stream and calls
- * {@link #doWriteRemoteInvocationResult} to actually write the object.
- * Can be overridden for custom serialization of the invocation.
- * @param request current HTTP request
- * @param response current HTTP response
- * @param result the RemoteInvocationResult object
- * @param os the OutputStream to write to
- * @throws IOException in case of I/O failure
- * @see #decorateOutputStream
- * @see #doWriteRemoteInvocationResult
- */
- protected void writeRemoteInvocationResult(
- HttpServletRequest request, HttpServletResponse response, RemoteInvocationResult result, OutputStream os)
- throws IOException {
-
- try (ObjectOutputStream oos =
- createObjectOutputStream(new FlushGuardedOutputStream(decorateOutputStream(request, response, os)))) {
- doWriteRemoteInvocationResult(result, oos);
- }
- }
-
- /**
- * Return the OutputStream to use for writing remote invocation results,
- * potentially decorating the given original OutputStream.
- * The default implementation returns the given stream as-is.
- * Can be overridden, for example, for custom encryption or compression.
- * @param request current HTTP request
- * @param response current HTTP response
- * @param os the original OutputStream
- * @return the potentially decorated OutputStream
- * @throws IOException in case of I/O failure
- */
- protected OutputStream decorateOutputStream(
- HttpServletRequest request, HttpServletResponse response, OutputStream os) throws IOException {
-
- return os;
- }
-
-
- /**
- * Decorate an {@code OutputStream} to guard against {@code flush()} calls,
- * which are turned into no-ops.
- * Because {@link ObjectOutputStream#close()} will in fact flush/drain
- * the underlying stream twice, this {@link FilterOutputStream} will
- * guard against individual flush calls. Multiple flush calls can lead
- * to performance issues, since writes aren't gathered as they should be.
- * @see SPR-14040
- */
- private static class FlushGuardedOutputStream extends FilterOutputStream {
-
- public FlushGuardedOutputStream(OutputStream out) {
- super(out);
- }
-
- @Override
- public void flush() throws IOException {
- // Do nothing on flush
- }
- }
-
-}
diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java
deleted file mode 100644
index 5c8e431fbaf2..000000000000
--- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright 2002-2018 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.remoting.httpinvoker;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpHandler;
-
-import org.springframework.remoting.support.RemoteInvocation;
-import org.springframework.remoting.support.RemoteInvocationResult;
-
-/**
- * HTTP request handler that exports the specified service bean as
- * HTTP invoker service endpoint, accessible via an HTTP invoker proxy.
- * Designed for Sun's JRE 1.6 HTTP server, implementing the
- * {@link com.sun.net.httpserver.HttpHandler} interface.
- *
- * Deserializes remote invocation objects and serializes remote invocation
- * result objects. Uses Java serialization just like RMI, but provides the
- * same ease of setup as Caucho's HTTP-based Hessian protocol.
- *
- * HTTP invoker is the recommended protocol for Java-to-Java remoting.
- * It is more powerful and more extensible than Hessian, at the expense of
- * being tied to Java. Nevertheless, it is as easy to set up as Hessian,
- * which is its main advantage compared to RMI.
- *
- * WARNING: Be aware of vulnerabilities due to unsafe Java deserialization:
- * Manipulated input streams could lead to unwanted code execution on the server
- * during the deserialization step. As a consequence, do not expose HTTP invoker
- * endpoints to untrusted clients but rather just between your own services.
- * In general, we strongly recommend any other message format (e.g. JSON) instead.
- *
- * @author Juergen Hoeller
- * @since 2.5.1
- * @see org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor
- * @see org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean
- * @deprecated as of Spring Framework 5.1, in favor of {@link HttpInvokerServiceExporter}
- */
-@Deprecated
-@org.springframework.lang.UsesSunHttpServer
-public class SimpleHttpInvokerServiceExporter extends org.springframework.remoting.rmi.RemoteInvocationSerializingExporter implements HttpHandler {
-
- /**
- * Reads a remote invocation from the request, executes it,
- * and writes the remote invocation result to the response.
- * @see #readRemoteInvocation(HttpExchange)
- * @see #invokeAndCreateResult(RemoteInvocation, Object)
- * @see #writeRemoteInvocationResult(HttpExchange, RemoteInvocationResult)
- */
- @Override
- public void handle(HttpExchange exchange) throws IOException {
- try {
- RemoteInvocation invocation = readRemoteInvocation(exchange);
- RemoteInvocationResult result = invokeAndCreateResult(invocation, getProxy());
- writeRemoteInvocationResult(exchange, result);
- exchange.close();
- }
- catch (ClassNotFoundException ex) {
- exchange.sendResponseHeaders(500, -1);
- logger.error("Class not found during deserialization", ex);
- }
- }
-
- /**
- * Read a RemoteInvocation from the given HTTP request.
- * Delegates to {@link #readRemoteInvocation(HttpExchange, InputStream)}
- * with the {@link HttpExchange#getRequestBody()} request's input stream}.
- * @param exchange current HTTP request/response
- * @return the RemoteInvocation object
- * @throws java.io.IOException in case of I/O failure
- * @throws ClassNotFoundException if thrown by deserialization
- */
- protected RemoteInvocation readRemoteInvocation(HttpExchange exchange)
- throws IOException, ClassNotFoundException {
-
- return readRemoteInvocation(exchange, exchange.getRequestBody());
- }
-
- /**
- * Deserialize a RemoteInvocation object from the given InputStream.
- * Gives {@link #decorateInputStream} a chance to decorate the stream
- * first (for example, for custom encryption or compression). Creates a
- * {@link org.springframework.remoting.rmi.CodebaseAwareObjectInputStream}
- * and calls {@link #doReadRemoteInvocation} to actually read the object.
- * Can be overridden for custom serialization of the invocation.
- * @param exchange current HTTP request/response
- * @param is the InputStream to read from
- * @return the RemoteInvocation object
- * @throws java.io.IOException in case of I/O failure
- * @throws ClassNotFoundException if thrown during deserialization
- */
- protected RemoteInvocation readRemoteInvocation(HttpExchange exchange, InputStream is)
- throws IOException, ClassNotFoundException {
-
- ObjectInputStream ois = createObjectInputStream(decorateInputStream(exchange, is));
- return doReadRemoteInvocation(ois);
- }
-
- /**
- * Return the InputStream to use for reading remote invocations,
- * potentially decorating the given original InputStream.
- * The default implementation returns the given stream as-is.
- * Can be overridden, for example, for custom encryption or compression.
- * @param exchange current HTTP request/response
- * @param is the original InputStream
- * @return the potentially decorated InputStream
- * @throws java.io.IOException in case of I/O failure
- */
- protected InputStream decorateInputStream(HttpExchange exchange, InputStream is) throws IOException {
- return is;
- }
-
- /**
- * Write the given RemoteInvocationResult to the given HTTP response.
- * @param exchange current HTTP request/response
- * @param result the RemoteInvocationResult object
- * @throws java.io.IOException in case of I/O failure
- */
- protected void writeRemoteInvocationResult(HttpExchange exchange, RemoteInvocationResult result)
- throws IOException {
-
- exchange.getResponseHeaders().set("Content-Type", getContentType());
- exchange.sendResponseHeaders(200, 0);
- writeRemoteInvocationResult(exchange, result, exchange.getResponseBody());
- }
-
- /**
- * Serialize the given RemoteInvocation to the given OutputStream.
- * The default implementation gives {@link #decorateOutputStream} a chance
- * to decorate the stream first (for example, for custom encryption or compression).
- * Creates an {@link java.io.ObjectOutputStream} for the final stream and calls
- * {@link #doWriteRemoteInvocationResult} to actually write the object.
- * Can be overridden for custom serialization of the invocation.
- * @param exchange current HTTP request/response
- * @param result the RemoteInvocationResult object
- * @param os the OutputStream to write to
- * @throws java.io.IOException in case of I/O failure
- * @see #decorateOutputStream
- * @see #doWriteRemoteInvocationResult
- */
- protected void writeRemoteInvocationResult(
- HttpExchange exchange, RemoteInvocationResult result, OutputStream os) throws IOException {
-
- ObjectOutputStream oos = createObjectOutputStream(decorateOutputStream(exchange, os));
- doWriteRemoteInvocationResult(result, oos);
- oos.flush();
- }
-
- /**
- * Return the OutputStream to use for writing remote invocation results,
- * potentially decorating the given original OutputStream.
- * The default implementation returns the given stream as-is.
- * Can be overridden, for example, for custom encryption or compression.
- * @param exchange current HTTP request/response
- * @param os the original OutputStream
- * @return the potentially decorated OutputStream
- * @throws java.io.IOException in case of I/O failure
- */
- protected OutputStream decorateOutputStream(HttpExchange exchange, OutputStream os) throws IOException {
- return os;
- }
-
-}
diff --git a/spring-web/src/main/java/org/springframework/web/HttpRequestHandler.java b/spring-web/src/main/java/org/springframework/web/HttpRequestHandler.java
index 187d9dd8c544..5552cadf6634 100644
--- a/spring-web/src/main/java/org/springframework/web/HttpRequestHandler.java
+++ b/spring-web/src/main/java/org/springframework/web/HttpRequestHandler.java
@@ -50,8 +50,7 @@
* DispatcherServlet, indicating that there will never be a view to render.
*
* As of Spring 2.0, Spring's HTTP-based remote exporters, such as
- * {@link org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter}
- * and {@link org.springframework.remoting.caucho.HessianServiceExporter},
+ * {@link org.springframework.remoting.caucho.HessianServiceExporter},
* implement this interface rather than the more extensive Controller interface,
* for minimal dependencies on Spring-specific web infrastructure.
*
@@ -71,7 +70,6 @@
* @see org.springframework.web.servlet.mvc.Controller
* @see org.springframework.web.servlet.mvc.LastModified
* @see org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter
- * @see org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter
* @see org.springframework.remoting.caucho.HessianServiceExporter
*/
@FunctionalInterface
diff --git a/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java b/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java
index 97be4db90667..8a18fc0e5e2e 100644
--- a/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java
+++ b/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java
@@ -37,8 +37,7 @@
* HttpRequestHandlerServlet servlet-name as defined in {@code web.xml}.
*
* This can for example be used to expose a single Spring remote exporter,
- * such as {@link org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter}
- * or {@link org.springframework.remoting.caucho.HessianServiceExporter},
+ * such as {@link org.springframework.remoting.caucho.HessianServiceExporter},
* per HttpRequestHandlerServlet definition. This is a minimal alternative
* to defining remote exporters as beans in a DispatcherServlet context
* (with advanced mapping and interception facilities being available there).
diff --git a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java
deleted file mode 100644
index 8a2c697b69d8..000000000000
--- a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerTests.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Copyright 2002-2021 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.remoting.httpinvoker;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.aopalliance.intercept.MethodInvocation;
-import org.junit.jupiter.api.Test;
-
-import org.springframework.beans.factory.BeanClassLoaderAware;
-import org.springframework.beans.testfixture.beans.ITestBean;
-import org.springframework.beans.testfixture.beans.TestBean;
-import org.springframework.remoting.RemoteAccessException;
-import org.springframework.remoting.support.DefaultRemoteInvocationExecutor;
-import org.springframework.remoting.support.RemoteInvocation;
-import org.springframework.remoting.support.RemoteInvocationResult;
-import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
-import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-
-/**
- * @author Juergen Hoeller
- * @since 09.08.2004
- */
-@SuppressWarnings("deprecation")
-class HttpInvokerTests {
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporter() {
- doTestHttpInvokerProxyFactoryBeanAndServiceExporter(false);
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithExplicitClassLoader() {
- doTestHttpInvokerProxyFactoryBeanAndServiceExporter(true);
- }
-
- private void doTestHttpInvokerProxyFactoryBeanAndServiceExporter(boolean explicitClassLoader) {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
-
- pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
- @Override
- protected RemoteInvocationResult doExecuteRequest(
- HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception {
- assertThat(config.getServiceUrl()).isEqualTo("https://myurl");
- MockHttpServletRequest request = new MockHttpServletRequest();
- MockHttpServletResponse response = new MockHttpServletResponse();
- request.setContent(baos.toByteArray());
- exporter.handleRequest(request, response);
- return readRemoteInvocationResult(
- new ByteArrayInputStream(response.getContentAsByteArray()), config.getCodebaseUrl());
- }
- });
- if (explicitClassLoader) {
- ((BeanClassLoaderAware) pfb.getHttpInvokerRequestExecutor()).setBeanClassLoader(getClass().getClassLoader());
- }
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThat(proxy.getName()).isEqualTo("myname");
- assertThat(proxy.getAge()).isEqualTo(99);
- proxy.setAge(50);
- assertThat(proxy.getAge()).isEqualTo(50);
- proxy.setStringArray(new String[] {"str1", "str2"});
- assertThat(Arrays.equals(new String[] {"str1", "str2"}, proxy.getStringArray())).isTrue();
- proxy.setSomeIntegerArray(new Integer[] {1, 2, 3});
- assertThat(Arrays.equals(new Integer[] {1, 2, 3}, proxy.getSomeIntegerArray())).isTrue();
- proxy.setNestedIntegerArray(new Integer[][] {{1, 2, 3}, {4, 5, 6}});
- Integer[][] integerArray = proxy.getNestedIntegerArray();
- assertThat(Arrays.equals(new Integer[] {1, 2, 3}, integerArray[0])).isTrue();
- assertThat(Arrays.equals(new Integer[] {4, 5, 6}, integerArray[1])).isTrue();
- proxy.setSomeIntArray(new int[] {1, 2, 3});
- assertThat(Arrays.equals(new int[] {1, 2, 3}, proxy.getSomeIntArray())).isTrue();
- proxy.setNestedIntArray(new int[][] {{1, 2, 3}, {4, 5, 6}});
- int[][] intArray = proxy.getNestedIntArray();
- assertThat(Arrays.equals(new int[] {1, 2, 3}, intArray[0])).isTrue();
- assertThat(Arrays.equals(new int[] {4, 5, 6}, intArray[1])).isTrue();
-
- assertThatIllegalStateException().isThrownBy(() ->
- proxy.exceptional(new IllegalStateException()));
- assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(() ->
- proxy.exceptional(new IllegalAccessException()));
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithIOException() throws Exception {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
-
- pfb.setHttpInvokerRequestExecutor((config, invocation) -> { throw new IOException("argh"); });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThatExceptionOfType(RemoteAccessException.class)
- .isThrownBy(() -> proxy.setAge(50))
- .withCauseInstanceOf(IOException.class);
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithGzipCompression() {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter() {
- @Override
- protected InputStream decorateInputStream(HttpServletRequest request, InputStream is) throws IOException {
- if ("gzip".equals(request.getHeader("Compression"))) {
- return new GZIPInputStream(is);
- }
- else {
- return is;
- }
- }
- @Override
- protected OutputStream decorateOutputStream(
- HttpServletRequest request, HttpServletResponse response, OutputStream os) throws IOException {
- if ("gzip".equals(request.getHeader("Compression"))) {
- return new GZIPOutputStream(os);
- }
- else {
- return os;
- }
- }
- };
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
-
- pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
- @Override
- protected RemoteInvocationResult doExecuteRequest(
- HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
- throws IOException, ClassNotFoundException {
- assertThat(config.getServiceUrl()).isEqualTo("https://myurl");
- MockHttpServletRequest request = new MockHttpServletRequest();
- request.addHeader("Compression", "gzip");
- MockHttpServletResponse response = new MockHttpServletResponse();
- request.setContent(baos.toByteArray());
- try {
- exporter.handleRequest(request, response);
- }
- catch (ServletException ex) {
- throw new IOException(ex.toString());
- }
- return readRemoteInvocationResult(
- new ByteArrayInputStream(response.getContentAsByteArray()), config.getCodebaseUrl());
- }
- @Override
- protected OutputStream decorateOutputStream(OutputStream os) throws IOException {
- return new GZIPOutputStream(os);
- }
- @Override
- protected InputStream decorateInputStream(InputStream is) throws IOException {
- return new GZIPInputStream(is);
- }
- });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThat(proxy.getName()).isEqualTo("myname");
- assertThat(proxy.getAge()).isEqualTo(99);
- proxy.setAge(50);
- assertThat(proxy.getAge()).isEqualTo(50);
-
- assertThatIllegalStateException().isThrownBy(() ->
- proxy.exceptional(new IllegalStateException()));
- assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(() ->
- proxy.exceptional(new IllegalAccessException()));
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithWrappedInvocations() {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter() {
- @Override
- protected RemoteInvocation doReadRemoteInvocation(ObjectInputStream ois)
- throws IOException, ClassNotFoundException {
- Object obj = ois.readObject();
- if (!(obj instanceof TestRemoteInvocationWrapper)) {
- throw new IOException("Deserialized object needs to be assignable to type [" +
- TestRemoteInvocationWrapper.class.getName() + "]: " + obj);
- }
- return ((TestRemoteInvocationWrapper) obj).remoteInvocation;
- }
- @Override
- protected void doWriteRemoteInvocationResult(RemoteInvocationResult result, ObjectOutputStream oos)
- throws IOException {
- oos.writeObject(new TestRemoteInvocationResultWrapper(result));
- }
- };
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
-
- pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
- @Override
- protected RemoteInvocationResult doExecuteRequest(
- HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception {
- assertThat(config.getServiceUrl()).isEqualTo("https://myurl");
- MockHttpServletRequest request = new MockHttpServletRequest();
- MockHttpServletResponse response = new MockHttpServletResponse();
- request.setContent(baos.toByteArray());
- exporter.handleRequest(request, response);
- return readRemoteInvocationResult(
- new ByteArrayInputStream(response.getContentAsByteArray()), config.getCodebaseUrl());
- }
- @Override
- protected void doWriteRemoteInvocation(RemoteInvocation invocation, ObjectOutputStream oos) throws IOException {
- oos.writeObject(new TestRemoteInvocationWrapper(invocation));
- }
- @Override
- protected RemoteInvocationResult doReadRemoteInvocationResult(ObjectInputStream ois)
- throws IOException, ClassNotFoundException {
- Object obj = ois.readObject();
- if (!(obj instanceof TestRemoteInvocationResultWrapper)) {
- throw new IOException("Deserialized object needs to be assignable to type ["
- + TestRemoteInvocationResultWrapper.class.getName() + "]: " + obj);
- }
- return ((TestRemoteInvocationResultWrapper) obj).remoteInvocationResult;
- }
- });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThat(proxy.getName()).isEqualTo("myname");
- assertThat(proxy.getAge()).isEqualTo(99);
- proxy.setAge(50);
- assertThat(proxy.getAge()).isEqualTo(50);
-
- assertThatIllegalStateException().isThrownBy(() ->
- proxy.exceptional(new IllegalStateException()));
- assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(() ->
- proxy.exceptional(new IllegalAccessException()));
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithInvocationAttributes() {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.setRemoteInvocationExecutor(new DefaultRemoteInvocationExecutor() {
- @Override
- public Object invoke(RemoteInvocation invocation, Object targetObject)
- throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- assertThat(invocation.getAttributes()).isNotNull();
- assertThat(invocation.getAttributes().size()).isEqualTo(1);
- assertThat(invocation.getAttributes().get("myKey")).isEqualTo("myValue");
- assertThat(invocation.getAttribute("myKey")).isEqualTo("myValue");
- return super.invoke(invocation, targetObject);
- }
- });
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
- pfb.setRemoteInvocationFactory(methodInvocation -> {
- RemoteInvocation invocation = new RemoteInvocation(methodInvocation);
- invocation.addAttribute("myKey", "myValue");
- assertThatIllegalStateException().isThrownBy(() ->
- invocation.addAttribute("myKey", "myValue"));
- assertThat(invocation.getAttributes()).isNotNull();
- assertThat(invocation.getAttributes().size()).isEqualTo(1);
- assertThat(invocation.getAttributes().get("myKey")).isEqualTo("myValue");
- assertThat(invocation.getAttribute("myKey")).isEqualTo("myValue");
- return invocation;
- });
-
- pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
- @Override
- protected RemoteInvocationResult doExecuteRequest(
- HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception {
- assertThat(config.getServiceUrl()).isEqualTo("https://myurl");
- MockHttpServletRequest request = new MockHttpServletRequest();
- MockHttpServletResponse response = new MockHttpServletResponse();
- request.setContent(baos.toByteArray());
- exporter.handleRequest(request, response);
- return readRemoteInvocationResult(
- new ByteArrayInputStream(response.getContentAsByteArray()), config.getCodebaseUrl());
- }
- });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThat(proxy.getName()).isEqualTo("myname");
- assertThat(proxy.getAge()).isEqualTo(99);
- }
-
- @Test
- void httpInvokerProxyFactoryBeanAndServiceExporterWithCustomInvocationObject() {
- TestBean target = new TestBean("myname", 99);
-
- final HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
- exporter.setServiceInterface(ITestBean.class);
- exporter.setService(target);
- exporter.setRemoteInvocationExecutor(new DefaultRemoteInvocationExecutor() {
- @Override
- public Object invoke(RemoteInvocation invocation, Object targetObject)
- throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- boolean condition = invocation instanceof TestRemoteInvocation;
- assertThat(condition).isTrue();
- assertThat(invocation.getAttributes()).isNull();
- assertThat(invocation.getAttribute("myKey")).isNull();
- return super.invoke(invocation, targetObject);
- }
- });
- exporter.afterPropertiesSet();
-
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl("https://myurl");
- pfb.setRemoteInvocationFactory(methodInvocation -> {
- RemoteInvocation invocation = new TestRemoteInvocation(methodInvocation);
- assertThat(invocation.getAttributes()).isNull();
- assertThat(invocation.getAttribute("myKey")).isNull();
- return invocation;
- });
-
- pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
- @Override
- protected RemoteInvocationResult doExecuteRequest(
- HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception {
- assertThat(config.getServiceUrl()).isEqualTo("https://myurl");
- MockHttpServletRequest request = new MockHttpServletRequest();
- MockHttpServletResponse response = new MockHttpServletResponse();
- request.setContent(baos.toByteArray());
- exporter.handleRequest(request, response);
- return readRemoteInvocationResult(
- new ByteArrayInputStream(response.getContentAsByteArray()), config.getCodebaseUrl());
- }
- });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
- assertThat(proxy.getName()).isEqualTo("myname");
- assertThat(proxy.getAge()).isEqualTo(99);
- }
-
- @Test
- void httpInvokerWithSpecialLocalMethods() {
- String serviceUrl = "https://myurl";
- HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
- pfb.setServiceInterface(ITestBean.class);
- pfb.setServiceUrl(serviceUrl);
-
- pfb.setHttpInvokerRequestExecutor((config, invocation) -> { throw new IOException("argh"); });
-
- pfb.afterPropertiesSet();
- ITestBean proxy = (ITestBean) pfb.getObject();
-
- // shouldn't go through to remote service
- assertThat(proxy.toString().contains("HTTP invoker")).isTrue();
- assertThat(proxy.toString().contains(serviceUrl)).isTrue();
- assertThat(proxy.hashCode()).isEqualTo(proxy.hashCode());
- assertThat(proxy.equals(proxy)).isTrue();
-
- // should go through
- assertThatExceptionOfType(RemoteAccessException.class)
- .isThrownBy(() -> proxy.setAge(50))
- .withCauseInstanceOf(IOException.class);
- }
-
-
- @SuppressWarnings("serial")
- private static class TestRemoteInvocation extends RemoteInvocation {
-
- TestRemoteInvocation(MethodInvocation methodInvocation) {
- super(methodInvocation);
- }
- }
-
-
- @SuppressWarnings("serial")
- private static class TestRemoteInvocationWrapper implements Serializable {
-
- private final RemoteInvocation remoteInvocation;
-
- TestRemoteInvocationWrapper(RemoteInvocation remoteInvocation) {
- this.remoteInvocation = remoteInvocation;
- }
- }
-
-
- @SuppressWarnings("serial")
- private static class TestRemoteInvocationResultWrapper implements Serializable {
-
- private final RemoteInvocationResult remoteInvocationResult;
-
- TestRemoteInvocationResultWrapper(RemoteInvocationResult remoteInvocationResult) {
- this.remoteInvocationResult = remoteInvocationResult;
- }
- }
-
-}
diff --git a/src/docs/asciidoc/integration.adoc b/src/docs/asciidoc/integration.adoc
index a5b0dc3e9fe6..23265140971e 100644
--- a/src/docs/asciidoc/integration.adoc
+++ b/src/docs/asciidoc/integration.adoc
@@ -374,10 +374,6 @@ The following remoting technologies are now deprecated and will not be replaced:
`RmiServiceExporter`, Spring supports both traditional RMI (with `java.rmi.Remote`
interfaces and `java.rmi.RemoteException`) and transparent remoting through RMI
invokers (with any Java interface).
-* <