コード例 #1
0
ファイル: ClientProviderFactory.java プロジェクト: Jutten/cxf
  @Override
  protected void setProviders(Object... providers) {
    List<ProviderInfo<? extends Object>> theProviders =
        prepareProviders((Object[]) providers, null);
    super.setCommonProviders(theProviders);
    for (ProviderInfo<? extends Object> provider : theProviders) {
      Class<?> providerCls = ClassHelper.getRealClass(provider.getProvider());
      if (filterContractSupported(provider, providerCls, ClientRequestFilter.class)) {
        addProviderToList(clientRequestFilters, provider);
      }

      if (filterContractSupported(provider, providerCls, ClientResponseFilter.class)) {
        addProviderToList(clientResponseFilters, provider);
      }

      if (ResponseExceptionMapper.class.isAssignableFrom(providerCls)) {
        addProviderToList(responseExceptionMappers, provider);
      }
    }
    Collections.sort(
        clientRequestFilters, new BindingPriorityComparator(ClientRequestFilter.class, true));
    Collections.sort(
        clientResponseFilters, new BindingPriorityComparator(ClientResponseFilter.class, false));

    injectContextProxies(responseExceptionMappers, clientRequestFilters, clientResponseFilters);
  }
コード例 #2
0
  private void createAndPublishEndpoint(String url, Object implementor) {
    ServerFactoryBean serverFactory = null;
    if (prototypeServerFactoryBeanName != null) {
      if (!beanFactory.isPrototype(prototypeServerFactoryBeanName)) {
        throw new IllegalArgumentException(
            "prototypeServerFactoryBeanName must indicate a scope='prototype' bean");
      }
      serverFactory = beanFactory.getBean(prototypeServerFactoryBeanName, ServerFactoryBean.class);
      customizedServerFactory = true;
    } else {
      serverFactory = new JaxWsServerFactoryBean();
    }

    serverFactory.setServiceBean(implementor);
    serverFactory.setServiceClass(ClassHelper.getRealClass(implementor));
    serverFactory.setAddress(url);

    DataBinding dataBinding = null;
    if (prototypeDataBindingBeanName != null) {
      if (!beanFactory.isPrototype(prototypeDataBindingBeanName)) {
        throw new IllegalArgumentException(
            "prototypeDataBindingBeanName must indicate a scope='prototype' bean");
      }
      customizedDataBinding = true;
      dataBinding = beanFactory.getBean(prototypeDataBindingBeanName, DataBinding.class);
    } else {
      dataBinding = new JAXBDataBinding();
    }

    serverFactory.setDataBinding(dataBinding);
    serverFactory.setBus(getServletBus());
    serverFactory.create();
  }
コード例 #3
0
  public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    Class<?> clazz = ClassHelper.getRealClass(getServletBus(), bean);

    if (clazz.isAnnotationPresent(WebService.class)) {
      WebService ws = clazz.getAnnotation(WebService.class);
      String url = urlPrefix + ws.serviceName();
      Message message = new Message("SELECTED_SERVICE", LOG, beanName, clazz.getName(), url);
      LOG.info(message.toString());

      createAndPublishEndpoint(url, bean);
      registerHandler(url, new ServletAdapter(shadowCxfServlet));
    } else {

      Message message = new Message("REJECTED_NO_ANNOTATION", LOG, beanName, clazz.getName());
      LOG.fine(message.toString());
    }

    return bean;
  }
コード例 #4
0
ファイル: EndpointImpl.java プロジェクト: Jutten/cxf
 /**
  * Gets the class of the implementor.
  *
  * @return the class of the implementor object
  */
 public Class<?> getImplementorClass() {
   return implementorClass != null ? implementorClass : ClassHelper.getRealClass(implementor);
 }
コード例 #5
0
 /**
  * The instance of the secured bean get injected by the IOC framework
  *
  * @param securedObject
  */
 public void setSecuredObject(Object securedObject) {
   Class<?> clazz = ClassHelper.getRealClass(securedObject);
   authorizationActionMap = getAuthorizationActionMap(clazz);
   superTenantServiceSet = getSuperTenantServiceSet(clazz);
 }