예제 #1
0
 @Before
 public void setUp() throws Exception {
   client =
       new JsonRpcHttpClient(
           new URL("http://webuntis.grupet.at:8080/WebUntis/jsonrpc.do?school=demo"));
   webUntisService =
       ProxyUtil.createProxy(getClass().getClassLoader(), WebUntisService.class, client);
 }
  /** {@inheritDoc} */
  public final void afterPropertiesSet() throws Exception {

    // find the ObjectMapper
    if (objectMapper == null
        && applicationContext != null
        && applicationContext.containsBean("objectMapper")) {
      objectMapper = (ObjectMapper) applicationContext.getBean("objectMapper");
    }
    if (objectMapper == null && applicationContext != null) {
      try {
        objectMapper =
            (ObjectMapper)
                BeanFactoryUtils.beanOfTypeIncludingAncestors(
                    applicationContext, ObjectMapper.class);
      } catch (Exception e) {
        /* no-op */
      }
    }
    if (objectMapper == null) {
      objectMapper = new ObjectMapper();
    }

    // create the service
    Object service =
        ProxyUtil.createCompositeServiceProxy(
            getClass().getClassLoader(), services, serviceInterfaces, allowMultipleInheritance);

    // create the server
    jsonRpcServer = new JsonRpcServer(objectMapper, service);
    jsonRpcServer.setErrorResolver(errorResolver);
    jsonRpcServer.setBackwardsComaptible(backwardsComaptible);
    jsonRpcServer.setRethrowExceptions(rethrowExceptions);
    jsonRpcServer.setAllowExtraParams(allowExtraParams);
    jsonRpcServer.setAllowLessParams(allowLessParams);

    // export
    exportService();
  }