org.eclipse.jst.j2ee.webapplication.WebApp类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中org.eclipse.jst.j2ee.webapplication.WebApp类的一些代码示例,展示了WebApp类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApp类的具体详情如下:
包路径:org.eclipse.jst.j2ee.webapplication.WebApp
类名称:WebApp

WebApp介绍

[英]The web-app element is the root of the deployment descriptor for a web application.
[中]web app元素是web应用程序部署描述符的根。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

/**
 * @param ref
 * @throws ArchiveWrappedException
 */
private void validateWebAppRefs(ModuleRef ref) throws ArchiveWrappedException {
  WebApp webApp = (WebApp)ref.getDeploymentDescriptor();
  List ejbRefs = new ArrayList();
  ejbRefs.addAll(webApp.getEjbRefs());
  ejbRefs.addAll(webApp.getEjbLocalRefs());
  validateEJBRefMandatoryElements(ejbRefs, ref.getUri());
  validateEJBRefs(ejbRefs, ref.getUri());
  if (webApp != null && webApp.getVersionID() <= J2EEVersionConstants.WEB_2_3_ID) {
    Set allRefs = new HashSet();
    List resourceRefs = webApp.getResourceRefs();
    List resourceEnvRefs = webApp.getResourceEnvRefs();
    List serviceRefs = webApp.getServiceRefs();
    
    validateDuplicateEJBRefs(allRefs,ejbRefs);
    validateDuplicateResourceRefs(allRefs,resourceRefs);
    validateDuplicateResourceEnvRefs(allRefs,resourceEnvRefs);
    validateDuplicateServiceRefs(allRefs,serviceRefs);
  }
}
/**

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public Collection getChildren(Object object) {
  Object webApp = weakWebApp.get();
  if (null != webApp) {
    return ((WebApp) webApp).getServletMappings();
  }
  return Collections.EMPTY_LIST;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public Collection getChildren(Object object) {
  List result = new ArrayList();
  if (weakWebApp!=null) {
    Object webApp = weakWebApp.get();
    if(null != webApp){
      result.addAll(((WebApp)webApp).getServlets());
    }
  }
  return getSortedChildren(result);
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public Collection getChildren(Object object) {
  List result = new ArrayList();
  Object obj = weakWebApp.get();
  if (null != obj) {
    WebApp webApp = (WebApp) obj;
    if (!webApp.getSecurityRoles().isEmpty())
      result.addAll(webApp.getSecurityRoles());
    if (!webApp.getConstraints().isEmpty())
      result.addAll(webApp.getConstraints());
  }
  return result;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.webservice

public Collection getServiceRefs(WebApp webapp) {
  List list = new ArrayList();
  try {
    if (webapp.getVersionID() >= J2EEVersionConstants.WEB_2_4_ID)
      list.addAll(webapp.getServiceRefs());
    else
      list.addAll(get13ServiceRefs(webapp));
  } catch (Exception e) {
    //Ignore
  }
  return list;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

protected void syncVersionOfRootObject() {
  WebApp app = getWebApp();
  if (app == null)
    return;

  String version = app.getVersion();
  String newVersion = getModuleVersionString();
  if (!newVersion.equals(version))
    app.setVersion(newVersion);
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public Collection getChildren(Object object) {
  List result = new ArrayList();
  Object obj = weakWebApp.get();
  if (null != obj) {
    WebApp webApp = (WebApp) obj;
    if (!webApp.getEjbLocalRefs().isEmpty())
      result.addAll(webApp.getEjbLocalRefs());
    if (!webApp.getEjbRefs().isEmpty())
      result.addAll(webApp.getEjbRefs());
    if (!webApp.getResourceEnvRefs().isEmpty())
      result.addAll(webApp.getResourceEnvRefs());
    if (!webApp.getResourceRefs().isEmpty())
      result.addAll(webApp.getResourceRefs());
    if (!webApp.getMessageDestinationRefs().isEmpty())
      result.addAll(webApp.getMessageDestinationRefs());
    if (!webApp.getServiceRefs().isEmpty())
      result.addAll(webApp.getServiceRefs());
    Collection serviceRefs = null;
    try {
      WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
      serviceRefs = serviceHelper.get13ServiceRefs(webApp);
    } catch (Exception re) {
      serviceRefs = Collections.EMPTY_LIST;
    }
    if (serviceRefs != null && !serviceRefs.isEmpty())
      result.addAll(serviceRefs);
  }
  return result;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

/**
 * WAR validation is driven by 3 prong approach: o XML/DTD validation (this is now handled by
 * the XML Validator) o Consistent web.xml data entry validation beyond DTD e.g., duplicate
 * entries, null entries etc. This is also driven by this validator. o web.xml reference to
 * resources in the "file system". This will not be provided by this validator. In the workbench
 * this function is already provided by the link builder.
 * 
 */
public void validate() throws ValidationException {
  validateMimeMapping();
  validateContextParameters();
  validateTagLibs();
  validateServletMappings(webDD.getServletMappings());
  validateWelcomeFileList(webDD.getFileList());
  validateErrorPages(webDD.getErrorPages());
  validateSecurityAndServlets();
  validateFilters(webDD.getFilters());
  validateFilterMappings(webDD.getFilterMappings());
  validateRefs();
  validateLoginConfig(webDD.getLoginConfig());
  validateEnvironmentEntries(webDD.getEnvironmentProperties());
  validateOther();
  validate14();
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

EList ejbRefs = webDD.getEjbRefs();
EList ejblocalRefs = webDD.getEjbLocalRefs();
EList resourceRefs = webDD.getResourceRefs();
  boolean isVersion22 = warFile.getDeploymentDescriptor().getVersionID() <= J2EEVersionConstants.WEB_2_2_ID;

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

/**
 * @param webAppObj as Object
 * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and versionID == 23
 */
public static boolean isWebApp23(Object webAppObj) {
  if (webAppObj instanceof WebApp &&
      ((WebApp)webAppObj).getVersionID() == 23)
    return true;
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

/**
 * validateSecurity(WebApp) - validate security constraints, roles, and security role refs -
 * details tbd
 */
public void validateSecurityAndServlets() {
  EList webRoles = webDD.getSecurityRoles();
  // Validate security roles
  Hashtable secRoles = getAndValidateSecurityRoles(webRoles);
  // Validate Servlets/JSPs and their role ref.
  validateServlets(webDD.getServlets(), secRoles);
  validateSecurityConstraints(webDD.getConstraints(), secRoles);
  // try {
  if (!(webRoles.isEmpty())) {
    EARFile module = warFile.getEARFile();
    if (module != null) {
      EList earRoleList = module.getDeploymentDescriptor().getSecurityRoles();
      validateWEBRolesWithEARRoles(earRoleList, webRoles);
    }
  }
  // } catch (UncontainedModuleFileException ue) {
  // String[] parms = new String[1];
  // parms[0] = warFile.getName();
  // addError(EREF_CATEGORY, ERROR_EAR_UNCONTAINED_MODULE_FILE_EXCEPTION, parms);
  // }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

String filesString = null;
if (webApp.getVersionID() == J2EEVersionConstants.WEB_2_3_ID) {
  EList contexts = webApp.getContexts();
  Iterator itContexts = contexts.iterator();
  while (itContexts.hasNext()) {
  EList contextParams = webApp.getContextParams();
  Iterator itContextParams = contextParams.iterator();
  while (itContextParams.hasNext()) {

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

Iterator cparams = webDD.getContexts().iterator();
while (cparams.hasNext()) {
Iterator servlets = webDD.getServlets().iterator();
while (servlets.hasNext()) {
  Servlet nextServlet = (Servlet) servlets.next();
Iterator filters = webDD.getFilters().iterator();
while (filters.hasNext()) {
  Filter nextFilter = (Filter) filters.next();

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

private void startLocatingJ2EEConfigs(WebApp webApp){
  webApp.eAdapters().add(contextParamAdapter);
  EList contexts = webApp.getContexts();
  if (contexts != null) {
    Iterator itContexts = contexts.iterator();
    while (itContexts.hasNext()) {
      ContextParam contextParam = (ContextParam)itContexts.next();
      contextParam.eAdapters().add(contextParamAdapter);
    }
  }
  EList contextParams = webApp.getContextParams();
  if (contextParams != null) {
    Iterator itContextParams = contextParams.iterator();
    while (itContextParams.hasNext()) {
      ParamValue paramValue = (ParamValue)itContextParams.next();
      paramValue.eAdapters().add(contextParamAdapter);
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.webservice

if (((WebApp) rootObject).getServiceRefs() != null && !((WebApp) rootObject).getServiceRefs().isEmpty())
  result.addAll(((WebApp) rootObject).getServiceRefs());

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
moduleVersion = webApp.getVersion();

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public IFile getAssociatedFile() {

    try { 
      WebApp webapp = (WebApp) weakWebApp.get();
      if(webapp != null && webapp.eResource() != null) {
        return WorkbenchResourceHelperBase.getIFile(webapp.eResource().getURI());
      }
    } catch (Throwable t) {
      
    }
    return null;		
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

/**
 * @param webApp
 * @return the default file extension from the context param.  Default is "jsp" if no context param.
 */
public static String getDefaultSuffix(WebApp webApp) {
  String defaultSuffix = "jsp"; //$NON-NLS-1$
  for (Iterator it = webApp.getContexts().iterator();it.hasNext();) {		
    ContextParam cp = (ContextParam) it.next();        
    if (cp != null &&
        cp.getParamName() != null && 
        cp.getParamName().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){                
      String defSuffix = cp.getParamValue();
      if (defSuffix.startsWith(".")) //$NON-NLS-1$
        defSuffix = defSuffix.substring(1);
              
      return defSuffix;
    }
  }
  return defaultSuffix;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core

/**
 * @param module
 * @return
 */
private List getEJBReferneces(Module module) throws ResourceLoadException, FileNotFoundException, EmptyResourceException {
  if (module != null) {
    if (module.isEjbModule()) {
      EJBJar ejbJar = getDeploymentDescriptor((EjbModule) module);
      return getEJBReferences(ejbJar);
    } else if (module.isWebModule()) {
      WebApp webApp = getDeploymentDescriptor((WebModule) module);
      if (webApp != null)
        return webApp.getEjbRefs();
    } else if (module.isJavaModule()) {
      ApplicationClient appClient = getDeploymentDescriptor((JavaClientModule) module);
      if (appClient != null)
        return appClient.getEjbReferences();
    }
  }
  return Collections.EMPTY_LIST;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

/**
 * @param webAppObj as Object
 * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and versionID == 24
 */
public static boolean isWebApp24(Object webAppObj) {
  if (webAppObj instanceof WebApp &&
      ((WebApp)webAppObj).getVersionID() == 24)
    return true;
  return false;
}

相关文章