/** * Search for a web component that I have by name. */ public WebComponentDescriptor getWebComponentByName(String name) { for (WebComponentDescriptor next : getWebComponentDescriptors()) { if (next.getName().equals(name)) { return (WebComponentDescriptor) next; } } return null; }
public Set<WebComponentDescriptor> getServletDescriptors() { Set<WebComponentDescriptor> servletDescriptors = new HashSet<WebComponentDescriptor>(); for (WebComponentDescriptor next : getWebComponentDescriptors()) { if (next.isServlet()) { servletDescriptors.add(next); } } return servletDescriptors; }
/** * @return my Set of jsps. */ public Set<WebComponentDescriptor> getJspDescriptors() { Set<WebComponentDescriptor> jspDescriptors = new HashSet<WebComponentDescriptor>(); for (WebComponentDescriptor next : getWebComponentDescriptors()) { if (!next.isServlet()) { jspDescriptors.add(next); } } return jspDescriptors; }
/** * Search for a web component that I have by name. */ public WebComponentDescriptor getWebComponentByCanonicalName(String name) { for (WebComponentDescriptor next : getWebComponentDescriptors()) { if (next.getCanonicalName().equals(name)) { return (WebComponentDescriptor) next; } } return null; }
/** * @return a set of web component descriptor of given impl name. */ public WebComponentDescriptor[] getWebComponentByImplName(String name) { ArrayList<WebComponentDescriptor> webCompList = new ArrayList<WebComponentDescriptor>(); for (WebComponentDescriptor webComp : getWebComponentDescriptors()) { if (webComp.getWebComponentImplementation().equals(name)) { webCompList.add(webComp); } } return webCompList.toArray(new WebComponentDescriptor[webCompList.size()]); }
/** * The number of Web Components in this application. * Current implementation only return the number of servlets * inside the application, and not the JSPs since we cannot * get that information from deployment descriptors. * * @return the number of Web Components */ public int getWebComponentCount() { int count = 0; for (WebBundleDescriptor wbd : getWebBundleDescriptors()) { count = count + wbd.getWebComponentDescriptors().size(); } return count; }
/** * The number of Web Components in this application. * Current implementation only return the number of servlets * inside the application, and not the JSPs since we cannot * get that information from deployment descriptors. * * @return the number of Web Components */ private static int getWebComponentCount(Application app) { int count = 0; for (WebBundleDescriptor wbd : app.getBundleDescriptors(WebBundleDescriptor.class)) { count = count + wbd.getWebComponentDescriptors().size(); } return count; }
private WebComponentDescriptor getJspDescriptor(WebBundleDescriptor wbd) { for (WebComponentDescriptor wcd: wbd.getWebComponentDescriptors()) { if (!wcd.isEnabled()) { continue; } String servletName = wcd.getWebComponentImplementation(); if ("org.apache.jasper.servlet.JspServlet".equals(servletName)) { return wcd; } } return null; }
/** * Remove the given web component from me. */ public void removeWebComponentDescriptor(WebComponentDescriptor webComponentDescriptor) { webComponentDescriptor.setWebBundleDescriptor(null); getWebComponentDescriptors().remove(webComponentDescriptor); resetUrlPatternToServletNameMap(); }
/** * Return all the references by a given component (by name) to the given rolename. */ public SecurityRoleReference getSecurityRoleReferenceByName(String compName, String roleName) { for (WebComponentDescriptor comp : getWebComponentDescriptors()) { if (!comp.getCanonicalName().equals(compName)) continue; SecurityRoleReference r = comp.getSecurityRoleReferenceByName(roleName); if (r != null) return r; } return null; }
private void initIncludeJars() { if (includeInitialized) { return; } String includeJarsString = null;; for (WebComponentDescriptor wcd: wbd.getWebComponentDescriptors()) { if ("jsp".equals(wcd.getCanonicalName())) { InitializationParameter initp = wcd.getInitializationParameterByName("system-jar-includes"); if (initp != null) { includeJarsString = initp.getValue(); break; } } } includeInitialized = true; if (includeJarsString == null) { includeJars = null; return; } includeJars = new ArrayList<String>(); StringTokenizer tokenizer = new StringTokenizer(includeJarsString); while (tokenizer.hasMoreElements()) { includeJars.add(tokenizer.nextToken()); } }
/** * This method is used by WebComponentDescriptor only. * The returned map is supposed to be only modified by the corresponding url patterns set. */ Map<String, String> getUrlPatternToServletNameMap() { if (urlPattern2ServletName == null) { urlPattern2ServletName = new HashMap<String, String>(); for (WebComponentDescriptor wc : getWebComponentDescriptors()) { String name = wc.getCanonicalName(); for (String up : wc.getUrlPatternsSet()) { String oldName = urlPattern2ServletName.put(up, name); if (oldName != null && (!oldName.equals(name))) { throw new RuntimeException(localStrings.getLocalString( "enterprise.deployment.exceptionsameurlpattern", "Servlet [{0}] and Servlet [{1}] have the same url pattern: [{2}]", new Object[] { oldName, name, up })); } } } } return urlPattern2ServletName; }
wbd.getWebComponentDescriptors()) { StringBuffer sb = new StringBuffer(); String canonicalName = wcd.getCanonicalName();
Iterator bundle = webDesc.getWebComponentDescriptors().iterator();
for (Iterator<WebComponentDescriptor> i = getWebComponentDescriptors().iterator(); i.hasNext();) { WebComponentDescriptor aWebComp = i.next(); aVisitor.accept(aWebComp);
"One or more web fragments define the same Servlet in a conflicting way, and the Servlet is not defined in web.xml")); } else { this.getWebComponentDescriptors().add(webComponentDescriptor);
wsc.setContextDelegate(context); wsc.setServletName(bundle.getWebComponentDescriptors());
Set<WebComponentDescriptor> set = wbd.getWebComponentDescriptors(); if (!set.isEmpty()) { Iterator<WebComponentDescriptor> iterator = set.iterator();
webBundleDesc.getWebComponentDescriptors().iterator(); webComponents.hasNext();) { WebComponentDescriptor webCompDesc =
private ObjectName registerWebModuleAndItsComponents( final ObjectName parentMBean, final MetadataImpl meta, final com.sun.enterprise.config.serverbeans.Application appConfig, final WebBundleDescriptor webBundleDescriptor ) { final String xmlDesc = getDeploymentDescriptor(webBundleDescriptor); if ( xmlDesc != null ) { meta.setDeploymentDescriptor( xmlDesc ); } final String moduleName = webBundleDescriptor.getModuleName(); final com.sun.enterprise.config.serverbeans.Module moduleConfig = getModuleConfig(appConfig, moduleName ); meta.setCorrespondingConfig(getObjectName(moduleConfig)); final ObjectName webModuleObjectName = registerJ2EEChild(parentMBean, meta, WebModule.class, WebModuleImpl.class, moduleName); meta.remove( Metadata.CORRESPONDING_CONFIG ); // none for a Servlet meta.remove( Metadata.DEPLOYMENT_DESCRIPTOR ); // none for an Servlet for (final WebComponentDescriptor desc : webBundleDescriptor.getWebComponentDescriptors()) { final String servletName = desc.getCanonicalName(); registerJ2EEChild(webModuleObjectName, meta, Servlet.class, ServletImpl.class, servletName); } return webModuleObjectName; }