Search in sources :

Example 11 with RemoteInvocation

use of org.springframework.remoting.support.RemoteInvocation in project spring-framework by spring-projects.

the class SimpleHttpInvokerServiceExporter method handle.

/**
	 * Reads a remote invocation from the request, executes it,
	 * and writes the remote invocation result to the response.
	 * @see #readRemoteInvocation(com.sun.net.httpserver.HttpExchange)
	 * @see #invokeAndCreateResult(org.springframework.remoting.support.RemoteInvocation, Object)
	 * @see #writeRemoteInvocationResult(com.sun.net.httpserver.HttpExchange, org.springframework.remoting.support.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);
    }
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation) RemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult)

Example 12 with RemoteInvocation

use of org.springframework.remoting.support.RemoteInvocation in project spring-framework by spring-projects.

the class JmsInvokerServiceExporter method onMessage.

@Override
public void onMessage(Message requestMessage, Session session) throws JMSException {
    RemoteInvocation invocation = readRemoteInvocation(requestMessage);
    if (invocation != null) {
        RemoteInvocationResult result = invokeAndCreateResult(invocation, this.proxy);
        writeRemoteInvocationResult(requestMessage, session, result);
    }
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation) RemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult)

Example 13 with RemoteInvocation

use of org.springframework.remoting.support.RemoteInvocation in project opennms by OpenNMS.

the class ServiceRegistryHttpInvokerProxyFactoryBean method createRemoteInvocation.

@Override
public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
    RemoteInvocation retval = super.createRemoteInvocation(methodInvocation);
    // Add the interface that is being used to access this service as an invocation attibute
    retval.addAttribute(ATTRIBUTE_INTERFACE_NAME, this.getServiceInterface().getName());
    return retval;
}
Also used : RemoteInvocation(org.springframework.remoting.support.RemoteInvocation)

Aggregations

RemoteInvocation (org.springframework.remoting.support.RemoteInvocation)13 RemoteInvocationResult (org.springframework.remoting.support.RemoteInvocationResult)11 Test (org.junit.Test)6 RemoteAccessException (org.springframework.remoting.RemoteAccessException)6 IOException (java.io.IOException)5 ITestBean (org.springframework.tests.sample.beans.ITestBean)5 TestBean (org.springframework.tests.sample.beans.TestBean)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 ServletException (javax.servlet.ServletException)3 MethodInvocation (org.aopalliance.intercept.MethodInvocation)3 MockHttpServletRequest (org.springframework.mock.web.test.MockHttpServletRequest)3 MockHttpServletResponse (org.springframework.mock.web.test.MockHttpServletResponse)3 RemoteInvocationFailureException (org.springframework.remoting.RemoteInvocationFailureException)2 DefaultRemoteInvocationExecutor (org.springframework.remoting.support.DefaultRemoteInvocationExecutor)2 RemoteInvocationFactory (org.springframework.remoting.support.RemoteInvocationFactory)2 NestedServletException (org.springframework.web.util.NestedServletException)2 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1