Get the DWR Container. If multiple DWR containers exist in the
ServletContext, the first found is returned.

@param context
The GeneratorContext
@return The DWR Container
356824
private Container getContainer(final GeneratorContext context) {
		List<Container> containers = StartupUtil
				.getAllPublishedContainers(context.getServletContext());
		// TODO: here we assume there is only one DWR Servlet / Container ... we
		// should find a way to math the container with the DWR mapping config
		for (Container container : containers) {
			return container;
		}
		throw new RuntimeException("FATAL: unable to find DWR Container!");
	}
682595
@Override
	public InputStream createResourceAsStream(GeneratorContext context) {

		InputStream is = null;
		if (FileNameUtils.hasImageExtension(context.getPath())) {
			is = helper.createStreamResource(context);
		}

		return is;
	}
284678
public static ContainerWrapper getContainer(HttpServletRequest request) throws Exception {
		ContainerFinderImp scf = new ContainerFinderImp();
		ServletContext sc = request.getSession().getServletContext();
		return scf.findContainer(new ServletContextWrapper(sc));
	}
109410
protected static function ctxGetContainer(ContextInterface $context): ContainerInterface
    {
        assert(static::ctxHasContainer($context));

        return $context->get(ContextProperties::CTX_CONTAINER);
    }
1352881
private ContextGeneralPanel getContextGeneralPanel(Context context) {
        for (AbstractParamPanel panel : contextPanels) {
            if (panel instanceof ContextGeneralPanel) {
                ContextGeneralPanel contextGeneralPanel = (ContextGeneralPanel) panel;
                if (contextGeneralPanel.getContextIndex() == context.getIndex()) {
                    return contextGeneralPanel;
                }
            }
        }
        return null;
    }
306202
public synchronized ContainerRegistryBuilder createContainerBuilder(AppContextWrapper context) {
		containerLoaderAnnotation.startScan(context);

		ContainerFactory containerFactory = new ContainerFactory();
		ContainerWrapper cw = containerFactory.create(containerLoaderAnnotation.getConfigInfo());

		ContainerComponents configComponents = containerLoaderXML.loadAllContainerConfig(context);
		ContainerComponents aspectConfigComponents = containerLoaderXML.loadAllAspectConfig(context);

		return createContainerBuilder(context, cw, configComponents, aspectConfigComponents);
	}
405785
private Map<String, CompiledClass> extractClassFileMap() {
    if (context instanceof StandardGeneratorContext) {
      StandardGeneratorContext standardContext = (StandardGeneratorContext) context;
      return standardContext.getCompilationState().getClassFileMap();
    } else {
      logger.log(TreeLogger.Type.WARN,
          String.format("Could not load generated classes from GWT context, "
              + "encountered unexpected generator type %s.", context.getClass()));
      return null;
    }
  }
617098
private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
        Repeatable repeatable = annoType.getAnnotation(Repeatable.class);
        return (repeatable == null) ? null : repeatable.value();
    }
589607
public void initialized(AppContextWrapper context) {
		ContainerRegistryBuilder cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
		if (cb != null)
			return;
		try {
			synchronized (context) {
				cb = containerBuilderContext.createContainerBuilder(context);
				context.setAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME, cb);
				Debug.logVerbose("[JdonFramework] Initialize the container OK ..");
			}
		} catch (Exception e) {
			Debug.logError("[JdonFramework] initialized error: " + e, module);
		}
	}
567793
public org.jbundle.util.osgi.ClassFinder getClassFinder(Object context)
    {
        if (!classServiceAvailable)
            return null;
        try {
            if (classFinder == null)
            {
                Class.forName("org.osgi.framework.BundleActivator");	// This tests to see if osgi exists
                //classFinder = (org.jbundle.util.osgi.ClassFinder)org.jbundle.util.osgi.finder.ClassFinderActivator.getClassFinder(context, -1);
                try {   // Use reflection so the smart jvm's don't try to retrieve this class.
                    Class<?> clazz = Class.forName("org.jbundle.util.osgi.finder.ClassFinderActivator");    // This tests to see if osgi exists
                    if (clazz != null)
                    {
                        java.lang.reflect.Method method = clazz.getMethod("getClassFinder", Object.class, int.class);
                        if (method != null)
                            classFinder = (org.jbundle.util.osgi.ClassFinder)method.invoke(null, context, -1);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return classFinder;
        } catch (ClassNotFoundException ex) {
            classServiceAvailable = false;	// Osgi is not installed, no need to keep trying
            return null;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
94456
public static TemplatedURLFormatter getTemplatedURLFormatter( ServletContext servletContext )
    {
        assert servletContext != null : "The ServletContext cannot be null.";

        if ( servletContext == null )
        {
            throw new IllegalArgumentException( "The ServletContext cannot be null." );
        }

        return ( TemplatedURLFormatter ) servletContext.getAttribute( TEMPLATED_URL_FORMATTER_ATTR );
    }
392765
public final DTMIterator getContextNodes()
  {

    try
    {
      DTMIterator cnl = getContextNodeList();

      if (null != cnl)
        return cnl.cloneWithReset();
      else
        return null;  // for now... this might ought to be an empty iterator.
    }
    catch (CloneNotSupportedException cnse)
    {
      return null;  // error reporting?
    }
  }
410713
protected ObjectNode getContainer(ObjectMapper mapper) {
    ObjectNode containerNode = mapper.createObjectNode();
    containerNode.put(MarathonConstants.CONTAINER_TYPE, "DOCKER");
    containerNode.set("docker", getDockerContainer(mapper));

    return containerNode;
  }
670322
protected static ClassLoader getContextClassLoader()
    {
        if (System.getSecurityManager() != null)
        {
            try
            {
                Object cl = AccessController.doPrivileged(new PrivilegedExceptionAction()
                {
                            public Object run() throws PrivilegedActionException
                            {
                                return Thread.currentThread().getContextClassLoader();
                            }
                });
                return (ClassLoader) cl;
            }
            catch (PrivilegedActionException pae)
            {
                throw new FacesException(pae);
            }
        }
        else
        {
            return Thread.currentThread().getContextClassLoader();
        }
    }
1082761
@Override
    protected com.ibm.ws.webcontainer.srt.SRTConnectionContext getConnectionContext() {
        // SRTConnectionContext srt = _threadLocal.get();
        // if (srt == null) {
        // srt = new SRTConnectionContext();
        // _threadLocal.set(srt);
        // }
        // return srt;

        /*
         * TODO: Investigate performance impact of removing thread locals and
         * instead creating a new connection context each time. The threadlocal
         * approach causes problems for requests that go async as a subsequent
         * request may use the same thread and therefore get the same
         * SRTServletRequest instance from the SRTConnectionContext.
         */

        // return new SRTConnectionContext();
        return connContextPool.get();
    }
121786
public ServletContext getCurrentServletContext() {
        final ClassLoader cl = getContextClassLoader();
        if (cl == null) {
            return null;
        }
        return servletContexts.get(cl);
    }
225897
public Reader createResource(GeneratorContext context) {

		InputStream is = createStreamResource(context);
		ReadableByteChannel chan = Channels.newChannel(is);
		return Channels.newReader(chan, context.getCharset().newDecoder(), -1);
	}