Package org.springframework.remoting.support

Examples of org.springframework.remoting.support.RemoteInvocation


    pfb.setServiceInterface(ITestBean.class);
    pfb.setServiceUrl("http://myurl");
    pfb.setRemoteInvocationFactory(new RemoteInvocationFactory() {
      @Override
      public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
        RemoteInvocation invocation = new RemoteInvocation(methodInvocation);
        invocation.addAttribute("myKey", "myValue");
        try {
          invocation.addAttribute("myKey", "myValue");
          fail("Should have thrown IllegalStateException");
        }
        catch (IllegalStateException ex) {
          // expected: already defined
        }
        assertNotNull(invocation.getAttributes());
        assertEquals(1, invocation.getAttributes().size());
        assertEquals("myValue", invocation.getAttributes().get("myKey"));
        assertEquals("myValue", invocation.getAttribute("myKey"));
        return invocation;
      }
    });

    pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
View Full Code Here


    pfb.setServiceInterface(ITestBean.class);
    pfb.setServiceUrl("http://myurl");
    pfb.setRemoteInvocationFactory(new RemoteInvocationFactory() {
      @Override
      public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
        RemoteInvocation invocation = new TestRemoteInvocation(methodInvocation);
        assertNull(invocation.getAttributes());
        assertNull(invocation.getAttribute("myKey"));
        return invocation;
      }
    });

    pfb.setHttpInvokerRequestExecutor(new AbstractHttpInvokerRequestExecutor() {
View Full Code Here

  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
      return "JMS invoker proxy for queue [" + this.queue + "]";
    }

    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result;
    try {
      result = executeRequest(invocation);
    }
    catch (JMSException ex) {
View Full Code Here

   * @see #invokeAndCreateResult(org.springframework.remoting.support.RemoteInvocation, Object)
   * @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) {
View Full Code Here

  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    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) {
View Full Code Here

    this.proxy = getProxyForService();
  }


  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

            }

            public Result invoke(Invocation invocation) throws RpcException {
                RpcResult result = new RpcResult();
                try {
                    RemoteInvocation i = new RemoteInvocation();
                    i.setMethodName(invocation.getMethodName());
                    i.setParameterTypes(invocation.getParameterTypes());
                    i.setArguments(invocation.getArguments());
                    result.setResult(((RmiInvocationHandler) remote).invoke(i));
                } catch (InvocationTargetException e) {
                    result.setException(e.getTargetException());
                } catch (Exception e) {
                    throw new RpcException(StringUtils.toString(e), e);
View Full Code Here

  private RemoteInvocationFactory remoteInvocationFactory = new DefaultRemoteInvocationFactory();

  @Override
  public Object invoke(MethodInvocation invocation) throws Throwable {
    RemoteInvocation remoteInvocation = getRemoteInvocationFactory().createRemoteInvocation(invocation);

    Object rawResult;
    if (getRoutingKey() == null) {
      // Use the template's default routing key
      rawResult = amqpTemplate.convertSendAndReceive(remoteInvocation);
View Full Code Here

    Object invocationRaw = messageConverter.fromMessage(message);
    if (invocationRaw == null || !(invocationRaw instanceof RemoteInvocation)) {
      send(new RuntimeException("The message does not contain a RemoteInvocation payload"), replyToAddress);
      return;
    }
    RemoteInvocation invocation = (RemoteInvocation) invocationRaw;

    RemoteInvocationResult remoteInvocationResult = invokeAndCreateResult(invocation, getService());
    send(remoteInvocationResult, replyToAddress);
  }
View Full Code Here

TOP

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

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.