/** * 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()); }
void setServletName(Set webComponentDescriptors) { Iterator it = webComponentDescriptors.iterator(); String endpointName = null; while (it.hasNext()) { WebComponentDescriptor desc = (WebComponentDescriptor)it.next(); String name = desc.getCanonicalName(); if (JAXWS_SERVLET.equals(desc.getWebComponentImplementation())) { endpointName = name; } if (desc.getSecurityRoleReferences().hasMoreElements()) { servletName = name; break; } } if (servletName == null) { servletName = endpointName; } }
@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 */ for (String urlPattern : urlPatterns) { wcd.addUrlPattern(urlPattern); } } return conflicts; }
private void computeRuntimeDefault(WebComponentDescriptor webComp) { if (!webComp.getUsesCallerIdentity()) { computeRunAsPrincipalDefault( webComp.getRunAsIdentity(), webComp.getApplication()); } }
public WebComponentContext(WebComponentDescriptor wComp) { setDescriptor(wComp); if (wComp.isServlet()) { componentClassName = wComp.getWebComponentImplementation(); } }
if (!getCanonicalName().equals(other.getCanonicalName())) { return; if ((isServlet() && !other.isServlet()) || (!isServlet() && other.isServlet())) { return; if (combineUrlPatterns || getUrlPatternsSet().size() == 0) { getUrlPatternsSet().addAll(other.getUrlPatternsSet()); other.getInitializationParameterSet().iterator(); initParamIter.hasNext();) { InitializationParameter initParam = initParamIter.next(); if (getInitializationParameterByName(initParam.getName()) == null) { getInitializationParameterSet().add(initParam); other.getSecurityRoleReferenceSet().iterator(); secRoleRefIter.hasNext();) { SecurityRoleReference secRoleRef = secRoleRefIter.next(); if (getSecurityRoleReferenceByName(secRoleRef.getRolename()) == null) { getSecurityRoleReferenceSet().add(secRoleRef); if (getLoadOnStartUp() == null) { setLoadOnStartUp(other.getLoadOnStartUp()); if (isAsyncSupported() == null) {
appendTextChild(myNode, WebTagNames.SERVLET_NAME, descriptor.getCanonicalName()); if (descriptor.isServlet()) { appendTextChild(myNode, WebTagNames.SERVLET_CLASS, descriptor.getWebComponentImplementation()); } else { appendTextChild(myNode, WebTagNames.JSP_FILENAME, descriptor.getWebComponentImplementation()); WebCommonNode.addInitParam(myNode, WebTagNames.INIT_PARAM, descriptor.getInitializationParameters()); if (descriptor.getLoadOnStartUp()!=null) { appendTextChild(myNode, WebTagNames.LOAD_ON_STARTUP, String.valueOf(descriptor.getLoadOnStartUp())); appendTextChild(myNode, WebTagNames.ENABLED, String.valueOf(descriptor.isEnabled())); appendTextChild(myNode, WebTagNames.ASYNC_SUPPORTED, String.valueOf(descriptor.isAsyncSupported())); RunAsIdentityDescriptor runAs = descriptor.getRunAsIdentity(); if (runAs!=null) { RunAsNode runAsNode = new RunAsNode(); Enumeration roleRefs = descriptor.getSecurityRoleReferences(); SecurityRoleRefNode roleRefNode = new SecurityRoleRefNode(); while (roleRefs.hasMoreElements()) { (MultipartConfigDescriptor)descriptor.getMultipartConfig(); if (multipartConfigDesc != null) { MultipartConfigNode multipartConfigNode = new MultipartConfigNode();
String webCompImpl = webCompDesc.getWebComponentImplementation(); if (webCompImpl != null && webCompImpl.length() > 0 && (!webCompImpl.equals(webCompClass.getName()) || !webCompDesc.isServlet())) { if (webCompDesc.isServlet()) { messageKey = "enterprise.deployment.annotation.handlers.servletimpldontmatch"; defaultMessage = "The servlet '{0}' has implementation '{1}' in xml. It does not match with '{2}' from annotation @{3}."; new Object[] { webCompDesc.getName(), webCompImpl, webCompClass.getName(), WebServlet.class.getName() })); return getDefaultFailedResult(); webCompDesc.setServlet(true); webCompDesc.setWebComponentImplementation(webCompClass.getName()); if (webCompDesc.getUrlPatternsSet().size() == 0) { String[] urlPatterns = webServletAn.urlPatterns(); if (urlPatterns == null || urlPatterns.length == 0) { webCompDesc.addUrlPattern(up); if (webCompDesc.getLoadOnStartUp() == null) { webCompDesc.setLoadOnStartUp(webServletAn.loadOnStartup()); if (initParams != null && initParams.length > 0) { for (WebInitParam initParam : initParams) { webCompDesc.addInitializationParameter( new EnvironmentProperty( initParam.name(), initParam.value(),
bundleDesc = ((WebComponentContext)annCtx).getDescriptor().getWebBundleDescriptor(); } else if ( !(annCtx instanceof WebBundleContext)) { return getInvalidAnnotatedElementHandlerResult( webComponent = new WebComponentDescriptor(); webComponent.setServlet(true); webComponent.setWebComponentImplementation(((Class) annElem).getCanonicalName()); webComponent.setName(endpoint.getEndpointName()); webComponent.addUrlPattern("/"+newWS.getName()); webBundle.addWebComponentDescriptor(webComponent);
(WebComponentDescriptor) endpoint.getWebComponentImpl(); WebBundleDescriptor bundle = webComp.getWebBundleDescriptor(); WebServicesDescriptor webServices = bundle.getWebServices(); Collection endpoints = Set urlPatterns = webComp.getUrlPatternsSet(); if( urlPatterns.size() == 1 ) { " has not been assigned an endpoint address " + " and is associated with servlet " + webComp.getCanonicalName() + " , which has " + urlPatterns.size() + " url patterns"; throw new IllegalStateException(msg);
public void setWebComponentImpl(WebComponentDescriptor webComponent) { ejbComponentImpl = null; ejbLink = null; webComponentLink = webComponent.getCanonicalName(); webComponentImpl = webComponent; }
public Node writeDescriptor(Element root, WebComponentDescriptor descriptor) { if (descriptor != null && descriptor.getRunAsIdentity() != null) { Node servletNode = appendChild(root, RuntimeTagNames.SERVLET_DESCRIPTOR); appendTextChild(servletNode, RuntimeTagNames.SERVLET_NAME, descriptor.getCanonicalName()); appendTextChild(servletNode, RuntimeTagNames.RUN_AS_PRINCIPAL_NAME, descriptor.getRunAsIdentity().getPrincipal()); return servletNode; } return null; } }
(WebComponentDescriptor)webCompsIt.next(); StringBuffer name = new StringBuffer(); name.append(" - "+wcd.getCanonicalName()); name.append(" [ "); Enumeration urlPs = wcd.getUrlPatterns(); while (urlPs.hasMoreElements()) { name.append(urlPs.nextElement().toString()); (RunAsIdentityDescriptor)wcd.getRunAsIdentity(); if (runas!=null) { String role = runas.getRoleName();
descriptor.getWebBundleDescriptor().getWebServices(); if ( (descriptor.getRunAsIdentity() != null) || webServices.hasEndpointsImplementedBy(descriptor) ) { Node servletNode = appendChild(parent, nodeName); appendTextChild(servletNode, RuntimeTagNames.SERVLET_NAME, descriptor.getCanonicalName()); if( descriptor.getRunAsIdentity() != null ) { appendTextChild(servletNode, RuntimeTagNames.PRINCIPAL_NAME, descriptor.getRunAsIdentity().getPrincipal());
boolean isConflict(WebComponentDescriptor other, boolean allowNullImplNameOverride) { if (conflict || other.isConflict()) { return true; } if (!getCanonicalName().equals(other.getCanonicalName())) { return false; } String otherImplFile = other.getWebComponentImplementation(); boolean matchImplName = (allowNullImplNameOverride) ? // note that "" and null are regarded as the same here (implFile == null || implFile.length() == 0 || otherImplFile == null || otherImplFile.length() == 0 || implFile.equals(otherImplFile)) : (((implFile == null || implFile.length() == 0) && (otherImplFile == null || otherImplFile.length() == 0)) || (implFile != null && implFile.equals(otherImplFile)) ); boolean otherAsyncSupported = (other.isAsyncSupported() != null) ? other.isAsyncSupported() : false; boolean thisAsyncSupported = (asyncSupported != null) ? asyncSupported : false; boolean matchAsyncSupported = (thisAsyncSupported == otherAsyncSupported); return !(matchImplName && matchAsyncSupported); } }
String name = comp.getCanonicalName(); Enumeration esrr = comp.getSecurityRoleReferences();
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, WebComponentContext[] webCompContexts) throws AnnotationProcessorException { RunAs runAsAn = (RunAs)ainfo.getAnnotation(); for (WebComponentContext webCompContext : webCompContexts) { WebComponentDescriptor webDesc = webCompContext.getDescriptor(); // override by xml if (webDesc.getRunAsIdentity() != null) { continue; } String roleName = runAsAn.value(); Role role = new Role(roleName); // add Role if not exists webDesc.getWebBundleDescriptor().addRole(role); RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor(); runAsDesc.setRoleName(roleName); webDesc.setRunAsIdentity(runAsDesc); } return getDefaultProcessedResult(); }
/** * 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(); sb.append("<"); String wcdType = (wcd.isServlet() ? "Servlet" : "JSP"); sb.append(wcdType); sb.append(">"); moduleSubComponentMap.put(canonicalName, sb.toString()); subComponentsMap.put(wcd.getCanonicalName(), wcdType);
String name = webComponentDescriptor.getCanonicalName(); WebComponentDescriptor webCompDesc = getWebComponentByCanonicalName(name); if (!webCompDesc.isConflict(webComponentDescriptor, true)) { webCompDesc.add(webComponentDescriptor, false); String implFile = webCompDesc.getWebComponentImplementation(); if (webComponentDescriptor.isConflict() && (implFile == null || implFile.length() == 0)) { if (webComponentDescriptor.isConflict()) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionconflictwebcomp",