FileDocCategorySizeDatePackage
ResourceInjectorImpl.javaAPI DocGlassfish v2 API4366Fri May 04 22:36:06 BST 2007com.sun.enterprise.web.jsp

ResourceInjectorImpl

public class ResourceInjectorImpl extends Object implements org.apache.jasper.runtime.ResourceInjector
SJSAS implementation of the org.apache.jasper.runtime.ResourceInjector interface.
author
Jan Luehe

Fields Summary
private com.sun.enterprise.InjectionManager
injectionMgr
private com.sun.enterprise.deployment.JndiNameEnvironment
desc
Constructors Summary
public ResourceInjectorImpl()
Constructor.

        injectionMgr = Switch.getSwitch().getInjectionManager();
    
Methods Summary
public voidinject(javax.servlet.jsp.tagext.JspTag handler)
Injects the injectable resources from the component environment associated with this ResourceInjectorImpl into the given tag handler instance.

param
handler The tag handler instance to be injected
throws
Exception if an error occurs during injection


        if( desc != null ) {
            injectionMgr.injectInstance(handler, desc);
        }
    
public voidsetContext(javax.servlet.ServletContext servletContext)
Associates this ResourceInjector with the component environment of the given servlet context.

param
servletContext The servlet context


        if (!(servletContext instanceof ApplicationContextFacade)) {
            return;
        }

        final ApplicationContextFacade contextFacade =
            (ApplicationContextFacade) servletContext;

        StandardContext context = null;

        if (System.getSecurityManager() != null) {
            context = (StandardContext) AccessController.doPrivileged(
                    new PrivilegedAction() {
                public Object run() {
                    return contextFacade.getUnwrappedContext();
                }
            });
        } else {
            context = contextFacade.getUnwrappedContext();
        }

        if (context != null) {
            desc = (JndiNameEnvironment)
                Switch.getSwitch().getDescriptorFor(context);
        }