/** * receives notiification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (WebTagNames.SERVLET_NAME.equals(element.getQName())) { descriptor.addServletName(value); } else if (WebTagNames.URL_PATTERN.equals(element.getQName())) { if (!URLPattern.isValid(value)) { // try trimming url (in case DD uses extra // whitespace for aligning) String trimmedUrl = value.trim(); // If URL Pattern does not start with "/" then // prepend it (for Servlet2.2 Web apps) Object parent = getParentNode().getDescriptor(); if (parent instanceof WebBundleDescriptor && ((WebBundleDescriptor) parent).getSpecVersion().equals("2.2")) { if (!trimmedUrl.startsWith("/") && !trimmedUrl.startsWith("*.")) { trimmedUrl = "/" + trimmedUrl; } } if (URLPattern.isValid(trimmedUrl)) { // warn user if url included \r or \n if (URLPattern.containsCRorLF(value)) { DOLUtils.getDefaultLogger() .log( Level.WARNING, "enterprise.deployment.backend.urlcontainscrlf", new Object[] {value}); } value = trimmedUrl; } else { throw new IllegalArgumentException( localStrings.getLocalString( "enterprise.deployment.invalidurlpattern", "Invalid URL Pattern: [{0}]", new Object[] {value})); } } descriptor.addURLPattern(value); } else if (WebTagNames.DISPATCHER.equals(element.getQName())) { descriptor.addDispatcher(value); } else super.setElementValue(element, value); }
/** * Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof ResourcePrincipal) { descriptor.setDefaultResourcePrincipal((ResourcePrincipal) newDescriptor); } else super.addDescriptor(newDescriptor); }