com.netflix.zuul
Class ZuulFilter

java.lang.Object
  extended by com.netflix.zuul.ZuulFilter
All Implemented Interfaces:
IZuulFilter, java.lang.Comparable<ZuulFilter>
Direct Known Subclasses:
FilterLoader.TestZuulFilter

public abstract class ZuulFilter
extends java.lang.Object
implements IZuulFilter, java.lang.Comparable<ZuulFilter>

Base abstract class for ZuulFilters. The base class defines abstract methods to define: filterType() - to classify a filter by type. Standard types in Zuul are "pre" for pre-routing filtering, "route" for routing to an origin, "post" for post-routing filters, "error" for error handling. We also support a "static" type for static responses see StaticResponseFilter. Any filterType made be created or added and run by calling FilterProcessor.runFilters(type)

filterOrder() must also be defined for a filter. Filters may have the same filterOrder if precedence is not important for a filter. filterOrders do not need to be sequential.

ZuulFilters may be disabled using Archius Properties.

By default ZuulFilters are static; they don't carry state. This may be overridden by overriding the isStaticFilter() property to false


Nested Class Summary
static class ZuulFilter.TestUnit
           
 
Constructor Summary
ZuulFilter()
           
 
Method Summary
 int compareTo(ZuulFilter filter)
           
 java.lang.String disablePropertyName()
          The name of the Archaius property to disable this filter.
abstract  int filterOrder()
          filterOrder() must also be defined for a filter.
abstract  java.lang.String filterType()
          to classify a filter by type.
 boolean isFilterDisabled()
          If true, the filter has been disabled by archaius and will not be run
 boolean isStaticFilter()
          By default ZuulFilters are static; they don't carry state.
 java.lang.Object runFilter()
          runFilter checks !isFilterDisabled() and shouldFilter().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.netflix.zuul.IZuulFilter
run, shouldFilter
 

Constructor Detail

ZuulFilter

public ZuulFilter()
Method Detail

filterType

public abstract java.lang.String filterType()
to classify a filter by type. Standard types in Zuul are "pre" for pre-routing filtering, "route" for routing to an origin, "post" for post-routing filters, "error" for error handling. We also support a "static" type for static responses see StaticResponseFilter. Any filterType made be created or added and run by calling FilterProcessor.runFilters(type)

Returns:
A String representing that type

filterOrder

public abstract int filterOrder()
filterOrder() must also be defined for a filter. Filters may have the same filterOrder if precedence is not important for a filter. filterOrders do not need to be sequential.

Returns:
the int order of a filter

isStaticFilter

public boolean isStaticFilter()
By default ZuulFilters are static; they don't carry state. This may be overridden by overriding the isStaticFilter() property to false

Returns:
true by default

disablePropertyName

public java.lang.String disablePropertyName()
The name of the Archaius property to disable this filter. by default it is zuul.[classname].[filtertype].disable

Returns:

isFilterDisabled

public boolean isFilterDisabled()
If true, the filter has been disabled by archaius and will not be run

Returns:

runFilter

public java.lang.Object runFilter()
                           throws java.lang.Throwable
runFilter checks !isFilterDisabled() and shouldFilter(). The run() method is invoked if both are true.

Returns:
the return from Object
Throws:
java.lang.Throwable

compareTo

public int compareTo(ZuulFilter filter)
Specified by:
compareTo in interface java.lang.Comparable<ZuulFilter>