Package org.springframework.remoting.support

Examples of org.springframework.remoting.support.RemoteInvocationResult



  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);
    }
  }
View Full Code Here


    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
      return "JMS invoker proxy for queue [" + this.queue + "]";
    }

    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result = null;
    try {
      result = executeRequest(invocation);
    }
    catch (JMSException ex) {
      throw new RemoteAccessException("Cannot access JMS invoker queue [" + this.queue + "]", ex);
View Full Code Here

   * @see #writeRemoteInvocationResult(com.sun.net.httpserver.HttpExchange, org.springframework.remoting.support.RemoteInvocationResult)
   */
  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) {
      throw new IOException("Class not found during deserialization", ex);
View Full Code Here

    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
      return "HTTP invoker proxy for service URL [" + getServiceUrl() + "]";
    }

    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result = null;
    try {
      result = executeRequest(invocation, methodInvocation);
    }
    catch (Throwable ex) {
      throw convertHttpInvokerAccessException(ex);
    }
    try {
      return recreateRemoteInvocationResult(result);
    }
    catch (Throwable ex) {
      if (result.hasInvocationTargetException()) {
        throw ex;
      }
      else {
        throw new RemoteInvocationFailureException("Invocation of method [" + methodInvocation.getMethod() +
            "] failed in HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
View Full Code Here

  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);
    }
View Full Code Here

    public void testSimpleHttpInvokerRequestExecutor() throws Exception {
        RemoteInvocation invocation =
                new RemoteInvocation("testSimpleHttpInvokerRequestExecutor", new Class[]{Long.class}, new Object[]{Long.valueOf(System.nanoTime())});
        TestingSimpleHttpInvokerRequestExecutor executor = new TestingSimpleHttpInvokerRequestExecutor(invocation.getMethodName());
        HttpInvokerClientConfiguration config = createMockConfiguration(executor.getColor(), ArrayUtil.EMPTY_STRINGS);
        RemoteInvocationResult result = executor.executeRequest(config, invocation);
        Object value = result.getValue();
        assertNotNull("No result value", value);
        assertTrue("Bad result value type: " + value.getClass().getSimpleName(), value instanceof RemoteInvocation);

        RemoteInvocation resultValue = (RemoteInvocation) value;
        assertEquals("Mismatched result method", invocation.getMethodName(), resultValue.getMethodName());
View Full Code Here

            assertEquals("Mismatched target value", "/" + invocation.getMethodName(), target);

            String color = request.getHeader(Color.TOKEN_NAME);
            assertFalse("No color provided", StringUtil.isEmpty(color));

            RemoteInvocationResult result = new RemoteInvocationResult(invocation);
            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentType(AbstractHttpInvokerRequestExecutor.CONTENT_TYPE_SERIALIZED_OBJECT);

            ObjectOutputStream rspStream = new ObjectOutputStream(response.getOutputStream());
            try {
View Full Code Here

        RemoteInvocation invocation = invoker.createRemoteInvocation("testSuccessfulRemoteInvocation");
        invocation.setAttributes(Collections.singletonMap("testSuccessfulRemoteInvocation", (Serializable) Long.valueOf(System.currentTimeMillis())));

        HttpInvokerClientConfiguration config =
                createMockConfiguration(invocation.getMethodName(), "http://hello/world", "http://here/testSuccessfulRemoteInvocation");
        RemoteInvocationResult result = invoker.executeRequest(config, invocation);
        Operation op = assertRemotingOperation(config, invocation, result);
        ExternalResourceDescriptor desc = assertExternalResource(op);
        assertNull("Unexpected external descriptor: " + desc, desc);
    }
View Full Code Here

        RemoteInvocation invocation = invoker.createRemoteInvocation("testFailedRemoteInvocation");
        invocation.setAttributes(Collections.singletonMap("testFailedRemoteInvocation", (Serializable) Long.valueOf(System.currentTimeMillis())));

        HttpInvokerClientConfiguration config =
                createMockConfiguration(invocation.getMethodName(), "http://goodbye/world", "http://there/testFailedRemoteInvocation");
        RemoteInvocationResult result = invoker.executeRequest(config, invocation);
        Operation op = assertRemotingOperation(config, invocation, result);
        ExternalResourceDescriptor desc = assertExternalResource(op);
        assertNull("Unexpected external descriptor: " + desc, desc);
        assertTraceError(op, result);
    }
View Full Code Here

        }

        public RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation)
                throws Exception {
            if (returnValue instanceof Throwable) {
                return new RemoteInvocationResult((Throwable) returnValue);
            } else {
                return new RemoteInvocationResult(returnValue);
            }
        }
View Full Code Here

TOP

Related Classes of org.springframework.remoting.support.RemoteInvocationResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.