예제 #1
0
 /** Publishes the endpoints declared to the provided WSEndpointDeploymentUnit */
 public List<Endpoint> publish(ServiceTarget target, WSEndpointDeploymentUnit unit)
     throws Exception {
   List<DeploymentAspect> aspects = DeploymentAspectsProvider.getSortedDeploymentAspects();
   ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
   Deployment dep = null;
   try {
     SecurityActions.setContextClassLoader(
         ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
     WSDeploymentBuilder.getInstance().build(unit);
     dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
     dep.addAttachment(ServiceTarget.class, target);
     DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
     dam.setDeploymentAspects(aspects);
     dam.deploy(dep);
   } finally {
     if (dep != null) {
       dep.removeAttachment(ServiceTarget.class);
     }
     SecurityActions.setContextClassLoader(origClassLoader);
   }
   Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
   deployment.addAttachment(
       StandardContext.class,
       startWebApp(host, unit)); // TODO simplify and use findChild later in destroy()/stopWebApp()
   return deployment.getService().getEndpoints();
 }
예제 #2
0
 @Override
 public void destroy(Context context) throws Exception {
   List<Endpoint> eps = context.getEndpoints();
   if (eps == null || eps.isEmpty()) {
     return;
   }
   Deployment deployment = eps.get(0).getService().getDeployment();
   List<DeploymentAspect> aspects = DeploymentAspectsProvider.getSortedDeploymentAspects();
   try {
     stopWebApp(deployment.getAttachment(StandardContext.class));
   } finally {
     ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
     try {
       SecurityActions.setContextClassLoader(
           ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
       DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
       dam.setDeploymentAspects(aspects);
       dam.undeploy(deployment);
     } finally {
       SecurityActions.setContextClassLoader(origClassLoader);
     }
   }
 }
예제 #3
0
  protected void configureEndpoint(EndpointImpl endpoint) {
    // Configure wsdl file publisher
    if (wsdlPublisher != null) {
      endpoint.setWsdlPublisher(wsdlPublisher);
    }
    // Configure according to the specified jaxws endpoint configuration
    if (!endpoint.isPublished()) // before publishing, we set the jaxws conf
    {
      final Object implementor = endpoint.getImplementor();

      // setup our invoker for http endpoints if invoker is not configured in jbossws-cxf.xml DD
      boolean isHttpEndpoint =
          endpoint.getAddress() != null
              && endpoint
                  .getAddress()
                  .substring(0, 5)
                  .toLowerCase(Locale.ENGLISH)
                  .startsWith("http");
      if ((endpoint.getInvoker() == null) && isHttpEndpoint) {
        final AnnotationsInfo ai = dep.getAttachment(AnnotationsInfo.class);
        endpoint.setInvoker(
            new JBossWSInvoker(ai.hasAnnotatedClasses(UseAsyncMethod.class.getName())));
      }

      // ** Endpoint configuration setup **
      final String endpointClassName = implementor.getClass().getName();
      final List<Endpoint> depEndpoints = dep.getService().getEndpoints();
      for (Endpoint depEndpoint : depEndpoints) {
        if (endpointClassName.equals(depEndpoint.getTargetBeanName())) {
          org.jboss.wsf.spi.metadata.config.EndpointConfig config = depEndpoint.getEndpointConfig();
          if (config == null) {
            // the ASIL did not set the endpoint configuration, perhaps because we're processing an
            // Endpoint.publish() API started endpoint or because we're on WildFly 8.0.0.Final or
            // previous version. We compute the config here then (clearly no container injection
            // will be performed on optional handlers attached to the config)
            BasicConfigResolver bcr = new BasicConfigResolver(dep, implementor.getClass());
            config = bcr.resolveEndpointConfig();
            depEndpoint.setEndpointConfig(config);
          }
          if (config != null) {
            endpoint.setEndpointConfig(config);
          }

          // also save Service QName and Port QName in the endpoint for later matches
          depEndpoint.setProperty(Message.WSDL_PORT, endpoint.getEndpointName());
          depEndpoint.setProperty(Message.WSDL_SERVICE, endpoint.getServiceName());
        }
      }

      // JASPI
      final JASPIAuthenticationProvider jaspiProvider =
          (JASPIAuthenticationProvider)
              ServiceLoader.loadService(
                  JASPIAuthenticationProvider.class.getName(),
                  null,
                  ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
      if (jaspiProvider == null) {
        Loggers.DEPLOYMENT_LOGGER.cannotFindJaspiClasses();
      } else {
        if (jaspiProvider.enableServerAuthentication(endpoint, depEndpoints.get(0))) {
          endpoint.getInInterceptors().add(new AuthenticationMgrSubjectCreatingInterceptor());
        }
      }
    }
  }