Package org.springframework.remoting.httpinvoker

Examples of org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean


@Configuration
@ComponentScan("org.demo.demo")
public class ApplicationConfig {
    @Bean
    public HttpInvokerProxyFactoryBean myService() {
        HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean();
        factory.setServiceUrl("/svc/dummy");
        factory.setServiceInterface(MyService.class);
        return factory;
    }
View Full Code Here


        };
    }

    @SuppressWarnings("unchecked")
    protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
        final HttpInvokerProxyFactoryBean httpProxyFactoryBean = new HttpInvokerProxyFactoryBean();
        httpProxyFactoryBean.setServiceUrl(url.toIdentityString());
        httpProxyFactoryBean.setServiceInterface(serviceType);
        String client = url.getParameter(Constants.CLIENT_KEY);
        if (client == null || client.length() == 0 || "simple".equals(client)) {
          SimpleHttpInvokerRequestExecutor httpInvokerRequestExecutor = new SimpleHttpInvokerRequestExecutor() {
        protected void prepareConnection(HttpURLConnection con,
            int contentLength) throws IOException {
          super.prepareConnection(con, contentLength);
          con.setReadTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
          con.setConnectTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
        }
          };
          httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
        } else if ("commons".equals(client)) {
          CommonsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new CommonsHttpInvokerRequestExecutor();
          httpInvokerRequestExecutor.setReadTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
          httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
        } else if (client != null && client.length() > 0) {
          throw new IllegalStateException("Unsupported http protocol client " + client + ", only supported: simple, commons");
        }
        httpProxyFactoryBean.afterPropertiesSet();
        return (T) httpProxyFactoryBean.getObject();
    }
View Full Code Here

  public static <T> T connect(String serviceUrl, Class<T> serviceInterface) {
      DefaultHttpClient httpClient = new DefaultHttpClient(cm);
      HttpComponentsHttpInvokerRequestExecutor httpExecutor = new HttpComponentsHttpInvokerRequestExecutor();
      httpExecutor.setHttpClient(httpClient);
     
      HttpInvokerProxyFactoryBean httpFactory = new HttpInvokerProxyFactoryBean();
      httpFactory.setHttpInvokerRequestExecutor(httpExecutor);
 
      httpFactory.setServiceUrl(serviceUrl);
      httpFactory.setServiceInterface(serviceInterface);
      httpFactory.afterPropertiesSet();
    try {
      return (T)(Object)httpFactory.getObject();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

               
                target.addComponent(getPage().get("feedback"));
            }

            private RuleReaderService getRuleReaderService(String servicesUrl) {
                HttpInvokerProxyFactoryBean invoker = new org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean();
                invoker.setServiceUrl(servicesUrl);
                invoker.setServiceInterface(RuleReaderService.class);
                invoker.afterPropertiesSet();
                return (RuleReaderService)invoker.getObject();
            }
        }.setDefaultFormProcessing(false));
       
        form.add(new CheckBox("allowRemoteAndInlineLayers",
                new PropertyModel<Boolean>(configModel,
View Full Code Here

TOP

Related Classes of org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean

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.