예제 #1
0
 public Collection<String> getServletNameMappings() {
   FilterMapping[] mappings = _servletHandler.getFilterMappings();
   List<String> names = new ArrayList<String>();
   for (FilterMapping mapping : mappings) {
     if (mapping.getFilterHolder() != FilterHolder.this) continue;
     String[] servlets = mapping.getServletNames();
     if (servlets != null && servlets.length > 0) names.addAll(Arrays.asList(servlets));
   }
   return names;
 }
예제 #2
0
 public Collection<String> getUrlPatternMappings() {
   FilterMapping[] mappings = _servletHandler.getFilterMappings();
   List<String> patterns = new ArrayList<String>();
   for (FilterMapping mapping : mappings) {
     if (mapping.getFilterHolder() != FilterHolder.this) continue;
     String[] specs = mapping.getPathSpecs();
     patterns.addAll(TypeUtil.asList(specs));
   }
   return patterns;
 }
예제 #3
0
 public void addMappingForUrlPatterns(
     EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns) {
   illegalStateIfContextStarted();
   FilterMapping mapping = new FilterMapping();
   mapping.setFilterHolder(FilterHolder.this);
   mapping.setPathSpecs(urlPatterns);
   mapping.setDispatcherTypes(dispatcherTypes);
   if (isMatchAfter) _servletHandler.addFilterMapping(mapping);
   else _servletHandler.prependFilterMapping(mapping);
 }
  protected void configure(FilterMapping filterMapping) {
    try {
      if (_urlPattern != null) filterMapping.createUrlPattern().addText(_urlPattern).init();

      if (_servletName != null) filterMapping.addServletName(_servletName);

      filterMapping.setFilterName(_filterName);

      if (_filterClass != null) filterMapping.setFilterClass(_filterClass);

      for (Map.Entry<String, String> entry : _initParamMap.entrySet()) {
        filterMapping.setInitParam(entry.getKey(), entry.getValue());
      }

      filterMapping.setInit(_init);

      // filterMapping.init();
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
  }