Class DynamicFilterLoader

java.lang.Object
com.netflix.zuul.DynamicFilterLoader
All Implemented Interfaces:
FilterLoader

@Singleton public final class DynamicFilterLoader extends Object implements FilterLoader
  • Constructor Details

  • Method Details

    • getFilter

      @Deprecated public ZuulFilter<?,?> getFilter(String sourceCode, String filterName) throws Exception
      Deprecated.
      it is unclear to me why this method is needed. Nothing seems to use it, and the swapping of code seems to happen elsewhere. This will be removed in a later Zuul release.
      Given source and name will compile and store the filter if it detects that the filter code has changed or the filter doesn't exist. Otherwise it will return an instance of the requested ZuulFilter.
      Throws:
      Exception
    • filterInstanceMapSize

      public int filterInstanceMapSize()
      Returns:
      the total number of Zuul filters
    • putFilter

      public boolean putFilter(File file)
      From a file this will read the ZuulFilter source code, compile it, and add it to the list of current filters a true response means that it was successful.
      Specified by:
      putFilter in interface FilterLoader
      Parameters:
      file - the file to load
      Returns:
      true if the filter in file successfully read, compiled, verified and added to Zuul
    • putFiltersForClasses

      public List<ZuulFilter<?,?>> putFiltersForClasses(String[] classNames) throws Exception
      Load and cache filters by className
      Specified by:
      putFiltersForClasses in interface FilterLoader
      Parameters:
      classNames - The class names to load
      Returns:
      List of the loaded filters
      Throws:
      Exception - If any specified filter fails to load, this will abort. This is a safety mechanism so we can prevent running in a partially loaded state.
    • putFilterForClassName

      public ZuulFilter<?,?> putFilterForClassName(String className) throws Exception
      Specified by:
      putFilterForClassName in interface FilterLoader
      Throws:
      Exception
    • getFiltersByType

      public SortedSet<ZuulFilter<?,?>> getFiltersByType(FilterType filterType)
      Returns a list of filters by the filterType specified
      Specified by:
      getFiltersByType in interface FilterLoader
    • getFilterByNameAndType

      public ZuulFilter<?,?> getFilterByNameAndType(String name, FilterType type)
      Specified by:
      getFilterByNameAndType in interface FilterLoader