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;
}
}
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;
}
Aggregations