FileDocCategorySizeDatePackage
CatalinaListener.javaAPI DocGlassfish v2 API4240Fri May 04 22:36:04 BST 2007com.sun.enterprise.web.connector.extension

CatalinaListener

public class CatalinaListener extends Object implements org.apache.catalina.ContainerListener
Listener used to receive events from Catalina when a Context is removed or when a Host is removed.
author
Jean-Francois Arcand

Fields Summary
Constructors Summary
Methods Summary
public voidcontainerEvent(org.apache.catalina.ContainerEvent event)

    
        if (Container.REMOVE_CHILD_EVENT.equals(event.getType()) ) {
            Context context;
            String contextPath;
            Host host;

            Object container = event.getData();            
            if ( container instanceof Context) {
                context = (Context)container;
                
                if ( context != null 
                        && context.findConstraints().length == 0 
                        && context.findFilterDefs().length == 0 ){
                                
                    contextPath = context.getPath();
                    host = (Host)context.getParent();
                    int[] ports = host.getPorts();
                    for (int i=0; i < ports.length; i++){
                        removeContextPath(ports[i],contextPath); 
                    }
                }
            } 
        }  
    
private voidremoveContextPath(int port, java.lang.String contextPath)
Remove from the FileCache all entries related to the Context path.

param
port the FileCacheFactory port
param
contextPath the Context path

        
        ArrayList<GrizzlyConfig> list = 
                GrizzlyConfig.getGrizzlyConfigInstances();
        for(GrizzlyConfig config: list){
            if (config.getPort() == port){
                config.invokeGrizzly("removeCacheEntry",
                        new Object[]{contextPath},
                        new String[]{"java.lang.String"});
            }
        }