/** * Returns the component. It creates a new one if none exists. * * @return The component. */ public Component getComponent() { Component result = this.component; if (result == null) { synchronized (ServerServlet.class) { if (result == null) { // Find the attribute name to use to store the component final String componentAttributeName = getInitParameter( NAME_COMPONENT_ATTRIBUTE, NAME_COMPONENT_ATTRIBUTE_DEFAULT); // Look up the attribute for a target result = (Component) getServletContext().getAttribute( componentAttributeName); if (result == null) { result = createComponent(); getServletContext().setAttribute( componentAttributeName, result); } } this.component = result; } } return result; }
result = (HttpServerHelper) getServletContext() .getAttribute(serverAttributeName); getServletContext().setAttribute(serverAttributeName, result);
result = (Application) getServletContext() .getAttribute(applicationAttributeName); result = createApplication(getComponent() .getContext()); getServletContext().setAttribute( applicationAttributeName, result);
for (final Enumeration<String> enum1 = getServletContext() .getInitParameterNames(); enum1.hasMoreElements();) { initParam = enum1.nextElement(); applicationContext.getParameters().add(initParam, getServletContext().getInitParameter(initParam));
for (final Enumeration<String> enum1 = getServletContext() .getInitParameterNames(); enum1.hasMoreElements();) { initParam = enum1.nextElement(); componentContext.getParameters().add(initParam, getServletContext().getInitParameter(initParam)); for (final Enumeration<String> namesEnum = getServletContext() .getAttributeNames(); namesEnum.hasMoreElements();) { attributeName = namesEnum.nextElement(); componentContext.getAttributes().put(attributeName, getServletContext().getAttribute(attributeName));