Ejemplo n.º 1
0
  @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);
  }
  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();
  }
  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;
  }
Ejemplo n.º 4
0
 /**
  * Gets the class of the implementor.
  *
  * @return the class of the implementor object
  */
 public Class<?> getImplementorClass() {
   return implementorClass != null ? implementorClass : ClassHelper.getRealClass(implementor);
 }
 /**
  * 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);
 }