Search in sources :

Example 6 with FilterDef

use of org.apache.catalina.deploy.FilterDef in project Payara by payara.

the class StandardContext method addFilter.

/**
 * Adds the filter with the given name and class name to this servlet
 * context.
 */
public FilterRegistration.Dynamic addFilter(String filterName, String className) {
    if (isContextInitializedCalled) {
        String msg = MessageFormat.format(rb.getString(LogFacade.SERVLET_CONTEXT_ALREADY_INIT_EXCEPTION), new Object[] { "addFilter", getName() });
        throw new IllegalStateException(msg);
    }
    if (filterName == null || filterName.length() == 0) {
        throw new IllegalArgumentException(rb.getString(LogFacade.NULL_EMPTY_FILTER_NAME_EXCEPTION));
    }
    synchronized (filterDefs) {
        // Make sure filter name is unique for this context
        if (findFilterDef(filterName) != null) {
            return null;
        }
        DynamicFilterRegistrationImpl regis = (DynamicFilterRegistrationImpl) filterRegisMap.get(filterName);
        FilterDef filterDef = null;
        if (null == regis) {
            filterDef = new FilterDef();
        } else {
            // Complete preliminary filter registration
            filterDef = regis.getFilterDefinition();
        }
        filterDef.setFilterName(filterName);
        filterDef.setFilterClassName(className);
        addFilterDef(filterDef, true, (regis == null));
        if (null == regis) {
            regis = (DynamicFilterRegistrationImpl) filterRegisMap.get(filterName);
        }
        return regis;
    }
}
Also used : FilterDef(org.apache.catalina.deploy.FilterDef)

Example 7 with FilterDef

use of org.apache.catalina.deploy.FilterDef in project Payara by payara.

the class ContextConfig method stop.

/**
 * Process a "stop" event for this Context.
 */
protected synchronized void stop() {
    if (log.isLoggable(Level.FINEST))
        log.log(Level.FINEST, LogFacade.PROCESSING_STOP_FINEST);
    int i;
    // Removing children
    Container[] children = context.findChildren();
    for (i = 0; i < children.length; i++) {
        context.removeChild(children[i]);
    }
    // Removing application parameters
    /*        ApplicationParameter[] applicationParameters =
            context.findApplicationParameters();
        for (i = 0; i < applicationParameters.length; i++) {
            context.removeApplicationParameter
                (applicationParameters[i].getName());
        }
*/
    // Removing security constraints
    context.removeConstraints();
    // Removing Ejbs
    /*
        ContextEjb[] contextEjbs = context.findEjbs();
        for (i = 0; i < contextEjbs.length; i++) {
            context.removeEjb(contextEjbs[i].getName());
        }
        */
    // Removing environments
    /*
        ContextEnvironment[] contextEnvironments = context.findEnvironments();
        for (i = 0; i < contextEnvironments.length; i++) {
            context.removeEnvironment(contextEnvironments[i].getName());
        }
        */
    // Removing errors pages
    context.removeErrorPages();
    // Removing filter defs
    FilterDef[] filterDefs = context.findFilterDefs();
    for (i = 0; i < filterDefs.length; i++) {
        context.removeFilterDef(filterDefs[i]);
    }
    // Removing filter maps
    context.removeFilterMaps();
    // Removing local ejbs
    /*
        ContextLocalEjb[] contextLocalEjbs = context.findLocalEjbs();
        for (i = 0; i < contextLocalEjbs.length; i++) {
            context.removeLocalEjb(contextLocalEjbs[i].getName());
        }
        */
    // Removing Mime mappings
    String[] mimeMappings = context.findMimeMappings();
    for (i = 0; i < mimeMappings.length; i++) {
        context.removeMimeMapping(mimeMappings[i]);
    }
    // Removing parameters
    String[] parameters = context.findParameters();
    for (i = 0; i < parameters.length; i++) {
        context.removeParameter(parameters[i]);
    }
    // Removing resource env refs
    /*
        String[] resourceEnvRefs = context.findResourceEnvRefs();
        for (i = 0; i < resourceEnvRefs.length; i++) {
            context.removeResourceEnvRef(resourceEnvRefs[i]);
        }
        */
    // Removing resource links
    /*
        ContextResourceLink[] contextResourceLinks =
            context.findResourceLinks();
        for (i = 0; i < contextResourceLinks.length; i++) {
            context.removeResourceLink(contextResourceLinks[i].getName());
        }
        */
    // Removing resources
    /*
        ContextResource[] contextResources = context.findResources();
        for (i = 0; i < contextResources.length; i++) {
            context.removeResource(contextResources[i].getName());
        }
        */
    // Removing sercurity role
    context.removeSecurityRoles();
    // Removing servlet mappings
    String[] servletMappings = context.findServletMappings();
    for (i = 0; i < servletMappings.length; i++) {
        context.removeServletMapping(servletMappings[i]);
    }
    // FIXME : Removing status pages
    // Removing welcome files
    context.removeWelcomeFiles();
    // Removing wrapper lifecycles
    context.removeWrapperLifecycles();
    // Removing wrapper listeners
    context.removeWrapperListeners();
    ok = true;
}
Also used : FilterDef(org.apache.catalina.deploy.FilterDef) SecurityConstraint(org.apache.catalina.deploy.SecurityConstraint)

Aggregations

FilterDef (org.apache.catalina.deploy.FilterDef)7 FilterMap (org.apache.catalina.deploy.FilterMap)3 HashMap (java.util.HashMap)2 CacheManager (com.sun.appserv.web.cache.CacheManager)1 CacheMapping (com.sun.appserv.web.cache.mapping.CacheMapping)1 ValueConstraint (com.sun.appserv.web.cache.mapping.ValueConstraint)1 File (java.io.File)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 DispatcherType (javax.servlet.DispatcherType)1 Container (org.apache.catalina.Container)1 SecurityConstraint (org.apache.catalina.deploy.SecurityConstraint)1 ServletMap (org.apache.catalina.deploy.ServletMap)1 Tomcat (org.apache.catalina.startup.Tomcat)1 org.glassfish.web.deployment.runtime (org.glassfish.web.deployment.runtime)1