Example #1
0
  /**
   * Returns context root associated with webservice deployment.
   *
   * <p>If there's application.xml descriptor provided defining nested web module, then context root
   * defined there will be returned. Otherwise context root defined in jboss-web.xml will be
   * returned.
   *
   * @param dep webservice deployment
   * @param jbossWebMD jboss web meta data
   * @return context root
   */
  public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
    final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
    final JBossAppMetaData jbossAppMD =
        unit.getParent() == null
            ? null
            : ASHelper.getOptionalAttachment(
                unit.getParent(), WSAttachmentKeys.JBOSS_APP_METADATA_KEY);

    String contextRoot = null;

    // prefer context root defined in application.xml over one defined in jboss-web.xml
    if (jbossAppMD != null) {
      final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
      if (moduleMD != null) {
        final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
        contextRoot = webModuleMD.getContextRoot();
      }
    }

    if (contextRoot == null) {
      contextRoot = jbossWebMD != null ? jbossWebMD.getContextRoot() : null;
    }

    return contextRoot;
  }
Example #2
0
 /**
  * Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment unit, if
  * any.
  *
  * @param unit
  * @return the JBossWebMetaData or null if either that or the parent WarMetaData are not found.
  */
 public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) {
   final WarMetaData warMetaData =
       ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
   JBossWebMetaData result = null;
   if (warMetaData != null) {
     result = warMetaData.getMergedJBossWebMetaData();
     if (result == null) {
       result = warMetaData.getJbossWebMetaData();
     }
   }
   return result;
 }
Example #3
0
  private static boolean isWebserviceEndpoint(
      final ServletMetaData servletMD, final List<Index> annotationIndexes) {
    final String endpointClassName = ASHelper.getEndpointName(servletMD);
    if (isJSP(endpointClassName)) return false;

    final DotName endpointDN = DotName.createSimple(endpointClassName);
    ClassInfo endpointClassInfo = null;
    for (final Index index : annotationIndexes) {
      endpointClassInfo = index.getClassByName(endpointDN);
      if (endpointClassInfo != null) {
        if (endpointClassInfo.annotations().containsKey(WEB_SERVICE_ANNOTATION)) return true;
        if (endpointClassInfo.annotations().containsKey(WEB_SERVICE_PROVIDER_ANNOTATION))
          return true;
      }
    }

    return false;
  }
Example #4
0
  /**
   * Returns true if unit contains JAXRPC EJB deployment.
   *
   * @param unit deployment unit
   * @return true if JAXRPC EJB deployment, false otherwise
   */
  public static boolean isJaxrpcEjbDeployment(final DeploymentUnit unit) {
    final DeploymentType deploymentType =
        ASHelper.getOptionalAttachment(unit, WSAttachmentKeys.DEPLOYMENT_TYPE_KEY);

    return DeploymentType.JAXRPC_EJB21.equals(deploymentType);
  }
Example #5
0
 /**
  * Returns true if unit contains JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment.
  *
  * @param unit deployment unit
  * @return true if JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment, false otherwise.
  */
 public static boolean isWebServiceDeployment(final DeploymentUnit unit) {
   return ASHelper.getOptionalAttachment(unit, WSAttachmentKeys.DEPLOYMENT_TYPE_KEY) != null;
 }
Example #6
0
 /**
  * Returns true if deployment unit have attachment value associated with the <b>key</b>.
  *
  * @param unit deployment unit
  * @param key attachment key
  * @return true if contains attachment, false otherwise
  */
 public static boolean hasAttachment(final DeploymentUnit unit, final AttachmentKey<?> key) {
   return ASHelper.getOptionalAttachment(unit, key) != null;
 }
Example #7
0
  /**
   * Gets list of JAXWS EJBs meta data.
   *
   * @param unit deployment unit
   * @return list of JAXWS EJBs meta data
   */
  public static List<WebServiceDeclaration> getJaxwsEjbs(final DeploymentUnit unit) {
    final WebServiceDeployment wsDeployment =
        ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.WEBSERVICE_DEPLOYMENT_KEY);

    return Collections.unmodifiableList(wsDeployment.getServiceEndpoints());
  }
Example #8
0
 /**
  * Gets list of JAXRPC servlets meta data.
  *
  * @param unit deployment unit
  * @return list of JAXRPC servlets meta data
  */
 public static List<ServletMetaData> getJaxrpcServlets(final DeploymentUnit unit) {
   return ASHelper.getWebServiceServlets(unit, false);
 }
Example #9
0
  /**
   * Returns true if unit contains either JAXRPC EJB or JAXRPC JSE deployment.
   *
   * @param unit deployment unit
   * @return true if either JAXRPC EJB or JAXRPC JSE deployment, false otherwise
   */
  public static boolean isJaxrpcDeployment(final DeploymentUnit unit) {
    final boolean isJaxrpcEjb = ASHelper.isJaxrpcEjbDeployment(unit);
    final boolean isJaxrpcJse = ASHelper.isJaxrpcJseDeployment(unit);

    return isJaxrpcEjb || isJaxrpcJse;
  }