Examples of RemoteInvocation


Examples of org.springframework.remoting.support.RemoteInvocation

  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);
    }
    catch (Throwable ex) {
View Full Code Here

Examples of org.springframework.remoting.support.RemoteInvocation

    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

Examples of org.springframework.remoting.support.RemoteInvocation

  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 = null;
    try {
      result = executeRequest(invocation);
    }
    catch (JMSException ex) {
View Full Code Here

Examples of org.springframework.remoting.support.RemoteInvocation

   * @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

Examples of org.springframework.remoting.support.RemoteInvocation

  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

Examples of org.springframework.remoting.support.RemoteInvocation

   */
  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

Examples of org.springframework.remoting.support.RemoteInvocation

    HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
    pfb.setServiceInterface(ITestBean.class);
    pfb.setServiceUrl("http://myurl");
    pfb.setRemoteInvocationFactory(new RemoteInvocationFactory() {
      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

Examples of org.springframework.remoting.support.RemoteInvocation

    HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
    pfb.setServiceInterface(ITestBean.class);
    pfb.setServiceUrl("http://myurl");
    pfb.setRemoteInvocationFactory(new RemoteInvocationFactory() {
      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

Examples of org.springframework.remoting.support.RemoteInvocation

      public AccessibleObject getStaticPart() {
        return setNameMethod;
      }
    };

    RemoteInvocation inv = new RemoteInvocation(mi);

    assertEquals("setName", inv.getMethodName());
    assertEquals("bla", inv.getArguments()[0]);
    assertEquals(String.class, inv.getParameterTypes()[0]);

    // this is a bit BS, but we need to test it
    inv = new RemoteInvocation();
    inv.setArguments(new Object[] { "bla" });
    assertEquals("bla", inv.getArguments()[0]);
    inv.setMethodName("setName");
    assertEquals("setName", inv.getMethodName());
    inv.setParameterTypes(new Class[] {String.class});
    assertEquals(String.class, inv.getParameterTypes()[0]);

    inv = new RemoteInvocation("setName", new Class[] {String.class}, new Object[] {"bla"});
    assertEquals("bla", inv.getArguments()[0]);
    assertEquals("setName", inv.getMethodName());
    assertEquals(String.class, inv.getParameterTypes()[0]);
  }
View Full Code Here

Examples of org.springframework.remoting.support.RemoteInvocation

            }

            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.setValue(((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
TOP
Copyright © 2018 www.massapi.com. 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.