code: public void addFilter(final WebAppFilter filter) {
  		NullArgumentException.validateNotNull(filter, "Filter");
  		NullArgumentException.validateNotNull(filter.getFilterName(),
  				"Filter name");
  		NullArgumentException.validateNotNull(filter.getFilterClass(),
  				"Filter class");
  		filters.put(filter.getFilterName(), filter);
  		// add url patterns and servlet names for filter mappings added before
  		// filter
  		for (WebAppFilterMapping mapping : getFilterMappings(filter
  				.getFilterName())) {
  			if (mapping.getUrlPattern() != null
  					&& mapping.getUrlPattern().trim().length() > 0) {
  				filter.addUrlPattern(mapping.getUrlPattern());
  			}
  			if (mapping.getServletName() != null
  					&& mapping.getServletName().trim().length() > 0) {
  				filter.addServletName(mapping.getServletName());
  			}
  		}
  	}
docs: Add a filter.
  
  @param filter to add
  @throws NullArgumentException if filter, filter name or filter class is null