/** * receives notification of the end of an XML element by the Parser * * @param element the xml tag identification * @return true if this node is done processing the XML sub tree */ public boolean endElement(XMLElement element) { if (WebTagNames.DISTRIBUTABLE.equals(element.getQName())) { descriptor.setDistributable(true); return false; } else { boolean allDone = super.endElement(element); if (allDone && servletMappings!=null) { for (Iterator keys = servletMappings.keySet().iterator(); keys.hasNext();) { String servletName = (String) keys.next(); Vector mappings = (Vector) servletMappings.get(servletName); WebComponentDescriptor servlet= descriptor.getWebComponentByCanonicalName(servletName); if (servlet!=null) { for (Iterator mapping = mappings.iterator();mapping.hasNext();) { servlet.addUrlPattern((String) mapping.next()); } } else { throw new RuntimeException("There is no web component by the name of " + servletName + " here."); } } } return allDone; } }
/** * 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 })); } } }
@Override protected void removePatternFromServlet(Wrapper wrapper, String pattern) { super.removePatternFromServlet(wrapper, pattern); WebBundleDescriptor wbd = getWebBundleDescriptor(); if (wbd == null) { throw new IllegalStateException( "Missing WebBundleDescriptor for " + getName()); } WebComponentDescriptor wcd = wbd.getWebComponentByCanonicalName(wrapper.getName()); if (wcd == null) { throw new IllegalStateException( "Missing WebComponentDescriptor for " + wrapper.getName()); } wcd.removeUrlPattern(pattern); }
private void setDefaultServletInitParam(String name, String value) { WebBundleDescriptor descriptor = (WebBundleDescriptor)getParentNode().getDescriptor(); WebComponentDescriptor defaultServletDesc = descriptor.getWebComponentByCanonicalName("default"); InitializationParameter initParam = getDefaultServletInitParam(defaultServletDesc, name, true); initParam.setValue(value); }
/** * receives notification 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) { String name = element.getQName(); if (name.equals(RuntimeTagNames.SERVLET_NAME)) { Object parentDesc = ((WLWebBundleRuntimeNode)getParentNode()).getDescriptor(); if (parentDesc instanceof WebBundleDescriptor) { descriptor = ((WebBundleDescriptor)parentDesc).getWebComponentByCanonicalName(value); } } else if (name.equals(RuntimeTagNames.RUN_AS_PRINCIPAL_NAME)) { if (descriptor != null && descriptor.getRunAsIdentity() != null) { descriptor.getRunAsIdentity().setPrincipal(value); } } else { super.setElementValue(element, value); } }
/** * 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 (RuntimeTagNames.SERVLET_NAME.equals(element.getQName())) { Object parentDesc = ((WebBundleRuntimeNode) getParentNode()).getWebBundleDescriptor(); if (parentDesc instanceof WebBundleDescriptor) { descriptor = ((WebBundleDescriptor) parentDesc).getWebComponentByCanonicalName(value); } } else if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) { if (descriptor!=null && descriptor.getRunAsIdentity()!=null) { descriptor.getRunAsIdentity().setPrincipal(value); } } else super.setElementValue(element, value); }
servletName = servletConfig.getServletName(); WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName); if( webComponent != null ) { WebServicesDescriptor webServices = webBundle.getWebServices();
contextRoot = webBundle.getContextRoot(); WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName);
private void updateServletEndpointRuntime() { WebComponentDescriptor wc = ((WebBundleDescriptor)webService.getBundleDescriptor()).getWebComponentByCanonicalName(webComponentImpl.getCanonicalName()); if(!(wc == webComponentImpl)){ setWebComponentImpl(wc);
@Override public Set<String> addMapping(String... urlPatterns) { Set<String> conflicts = super.addMapping(urlPatterns); if (conflicts.isEmpty() && urlPatterns != null && urlPatterns.length > 0) { /* * Propagate the new mappings to the underlying * WebBundleDescriptor provided by the deployment backend, * so that corresponding security constraints may be calculated * by the security subsystem, which uses the * WebBundleDescriptor as its input */ WebBundleDescriptor wbd = ((WebModule) getContext()).getWebBundleDescriptor(); if (wbd == null) { throw new IllegalStateException( "Missing WebBundleDescriptor for " + getContext().getName()); } WebComponentDescriptor wcd = wbd.getWebComponentByCanonicalName(getName()); if (wcd == null) { throw new IllegalStateException( "Missing WebComponentDescriptor for " + getName()); } for (String urlPattern : urlPatterns) { wcd.addUrlPattern(urlPattern); } } return conflicts; } }
private void updateServletEndpointRuntime() { WebComponentDescriptor wc = ((WebBundleDescriptor)webService.getBundleDescriptor()).getWebComponentByCanonicalName(webComponentImpl.getCanonicalName()); if(!(wc == webComponentImpl)){ setWebComponentImpl(wc);
WebComponentDescriptor webCompDesc = getWebComponentByCanonicalName(name);
/** * Convert the contents of the ejb-link or servlet-link element to * an object representing the implementation component. */ public boolean resolveComponentLink() { boolean resolved = false; if( ejbLink != null ) { EjbBundleDescriptor ejbBundle = getEjbBundle(); if( ejbBundle.hasEjbByName(ejbLink) ) { resolved = true; EjbDescriptor ejb = ejbBundle.getEjbByName(ejbLink); setEjbComponentImpl(ejb); } } else if( webComponentLink != null ) { WebBundleDescriptor webBundle = getWebBundle(); WebComponentDescriptor webComponent = (WebComponentDescriptor) webBundle. getWebComponentByCanonicalName(webComponentLink); if( webComponent != null ) { resolved = true; setWebComponentImpl(webComponent); } } return resolved; }
/** * Convert the contents of the ejb-link or servlet-link element to * an object representing the implementation component. */ public boolean resolveComponentLink() { boolean resolved = false; if( ejbLink != null ) { EjbBundleDescriptor ejbBundle = getEjbBundle(); if( ejbBundle.hasEjbByName(ejbLink) ) { resolved = true; EjbDescriptor ejb = ejbBundle.getEjbByName(ejbLink); setEjbComponentImpl(ejb); } } else if( webComponentLink != null ) { WebBundleDescriptor webBundle = getWebBundle(); WebComponentDescriptor webComponent = (WebComponentDescriptor) webBundle. getWebComponentByCanonicalName(webComponentLink); if( webComponent != null ) { resolved = true; setWebComponentImpl(webComponent); } } return resolved; }
@Override protected HandlerProcessingResult processAnnotation( AnnotationInfo ainfo, WebBundleContext webBundleContext) throws AnnotationProcessorException { WebServlet webServletAn = (WebServlet)ainfo.getAnnotation(); Class webCompClass = (Class)ainfo.getAnnotatedElement(); String servletName = webServletAn.name(); if (servletName == null || servletName.length() == 0) { servletName = webCompClass.getName(); } WebComponentDescriptor webCompDesc = webBundleContext.getDescriptor().getWebComponentByCanonicalName(servletName); if (webCompDesc == null) { webCompDesc = new WebComponentDescriptor(); webCompDesc.setName(servletName); webCompDesc.setCanonicalName(servletName); } HandlerProcessingResult result = processAnnotation(ainfo, webCompDesc); if (result.getOverallResult() == ResultType.PROCESSED) { webBundleContext.getDescriptor().addWebComponentDescriptor(webCompDesc); WebComponentContext webCompContext = new WebComponentContext(webCompDesc); // we push the new context on the stack... webBundleContext.getProcessingContext().pushHandler(webCompContext); } return result; }
wcd = wbd.getWebComponentByCanonicalName(wrapper.getName()); if (wcd == null) {
public Node writeDescriptor(Element root, WebBundleDescriptor webBundleDescriptor) { Node containerDescriptorNode = null; WebComponentDescriptor defaultServletDesc = webBundleDescriptor.getWebComponentByCanonicalName("default"); InitializationParameter listingsParam = getDefaultServletInitParam( defaultServletDesc, "listings", false); InitializationParameter sortedByParam = getDefaultServletInitParam( defaultServletDesc, "sortedBy", false); ClassLoader clBean = webBundleDescriptor.getSunDescriptor().getClassLoader(); containerDescriptorNode = appendChild(root, RuntimeTagNames.CONTAINER_DESCRIPTOR); if (listingsParam != null) { appendTextChild(containerDescriptorNode, RuntimeTagNames.INDEX_DIRECTORY_ENALBED, listingsParam.getValue()); } if (sortedByParam != null) { appendTextChild(containerDescriptorNode, RuntimeTagNames.INDEX_DIRECTORY_SORT_BY, sortedByParam.getValue()); } appendTextChild(containerDescriptorNode, RuntimeTagNames.SAVE_SESSIONS_ENABLED, Boolean.toString(webBundleDescriptor.getKeepState())); if (clBean != null) { appendTextChild(containerDescriptorNode, RuntimeTagNames.PREFER_WEB_INF_CLASSES, clBean.getAttributeValue(ClassLoader.DELEGATE)); } return containerDescriptorNode; }
getWebComponentByCanonicalName(endpoint.getWebComponentLink());
getWebComponentByCanonicalName(endpoint.getWebComponentLink());
getWebComponentByCanonicalName(endpoint.getWebComponentLink());