/** * Removes a URL pattern from this web component. */ public void removeUrlPattern(String urlPattern) { getUrlPatternsSet().remove(urlPattern); }
/** * Adds an alias to this web component. */ public void addUrlPattern(String urlPattern) { getUrlPatternsSet().add(urlPattern); }
/** * @return an enumeration of (String) URL pattern aliases for this component. */ public Enumeration<String> getUrlPatterns() { return (new Vector(getUrlPatternsSet())).elements(); }
@Override public Set<String> setServletSecurity(ServletSecurityElement constraint) { this.servletSecurityElement = constraint; Set<String> conflictUrls = new HashSet<String>(wcd.getUrlPatternsSet()); conflictUrls.removeAll(ServletSecurityHandler.getUrlPatternsWithoutSecurityConstraint(wcd)); conflictUrls.addAll(super.setServletSecurity(constraint)); return conflictUrls; }
/** * Given a WebComponentDescriptor, find the set of urlPattern which does not have * any existing url pattern in SecurityConstraint * @param webCompDesc * @return a list of url String */ public static Set<String> getUrlPatternsWithoutSecurityConstraint(WebComponentDescriptor webCompDesc) { Set<String> urlPatternsWithoutSC = new HashSet<String>(webCompDesc.getUrlPatternsSet()); WebBundleDescriptor webBundleDesc = webCompDesc.getWebBundleDescriptor(); Set<String> urlPatterns = webCompDesc.getUrlPatternsSet(); Enumeration<SecurityConstraint> eSecConstr = webBundleDesc.getSecurityConstraints(); while (eSecConstr.hasMoreElements()) { SecurityConstraint sc = eSecConstr.nextElement(); for (WebResourceCollection wrc : sc.getWebResourceCollections()) { urlPatternsWithoutSC.removeAll(wrc.getUrlPatterns()); } } return urlPatternsWithoutSC; }
/** * 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; }
/** * Adds a new Web Component Descriptor to me. * @param webComponentDescriptor */ public void addWebComponentDescriptor(WebComponentDescriptor webComponentDescriptor) { String name = webComponentDescriptor.getCanonicalName(); webComponentDescriptor.setWebBundleDescriptor(this); WebComponentDescriptor webCompDesc = getWebComponentByCanonicalName(name); WebComponentDescriptor resultDesc = combineWebComponentDescriptor(webComponentDescriptor); // sync up urlPattern2ServletName map for (String up : resultDesc.getUrlPatternsSet()) { String oldName = getUrlPatternToServletNameMap().put(up, name); if (oldName != null && (!oldName.equals(name))) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionsameurlpattern", "Servlet [{0}] and Servlet [{1}] have the same url pattern: [{2}]", new Object[] { oldName, name, up })); } } }
Set urlPatterns = webComp.getUrlPatternsSet(); if( urlPatterns.size() == 1 ) {
Set urlPatterns = webComponentImpl.getUrlPatternsSet(); if( urlPatterns.size() == 1 ) {
Set urlPatterns = webComponentImpl.getUrlPatternsSet(); if( urlPatterns.size() == 1 ) {
if (combineUrlPatterns || getUrlPatternsSet().size() == 0) { getUrlPatternsSet().addAll(other.getUrlPatternsSet());
/** * The copy constructor. */ public WebComponentDescriptor(WebComponentDescriptor other) { setCanonicalName(other.getCanonicalName()); setServlet(other.isServlet()); setWebComponentImplementation( other.getWebComponentImplementation()); getInitializationParameterSet().addAll( other.getInitializationParameterSet()); getUrlPatternsSet().addAll(other.getUrlPatternsSet()); setLoadOnStartUp(other.getLoadOnStartUp()); getSecurityRoleReferenceSet().addAll( other.getSecurityRoleReferenceSet()); setRunAsIdentity(other.getRunAsIdentity()); setAsyncSupported(other.isAsyncSupported()); setMultipartConfig(other.getMultipartConfig()); setWebBundleDescriptor(other.getWebBundleDescriptor()); setConflict(other.isConflict()); }
for (Iterator servletsIterator = servlets.iterator(); servletsIterator.hasNext();) { WebComponentDescriptor aServlet = (WebComponentDescriptor) servletsIterator.next(); for (Iterator patterns = aServlet.getUrlPatternsSet().iterator();patterns.hasNext();) { String pattern = (String) patterns.next(); Node mappingNode= appendChild(jarNode, WebTagNames.SERVLET_MAPPING);
webCompDesc.setWebComponentImplementation(webCompClass.getName()); if (webCompDesc.getUrlPatternsSet().size() == 0) { String[] urlPatterns = webServletAn.urlPatterns(); if (urlPatterns == null || urlPatterns.length == 0) {
for (String urlPattern: webComponentDescriptor.getUrlPatternsSet()) { String servletName = null; if (urlPattern2ServletName != null) { webComponentDescriptor.getUrlPatternsSet().removeAll(removeUrlPatterns);
for (String pattern : webComponentDesc.getUrlPatternsSet()) { webModule.addServletMapping(pattern, webComponentDesc.getCanonicalName());