This is the method to override/implement to create your own Filter.
This is the method to override/implement to create your own Filter.
the input request type
a service that takes the output request type and the input response type
Terminates a filter chain in a service.
Terminates a filter chain in a service. For example,
myFilter.andThen(myService)
a service that takes the output request type and the input response type.
Chains a series of filters together:
Chains a series of filters together:
myModularService = handleExceptions.andThen(thrift2Pojo.andThen(parseString))
Note: synchronously thrown exceptions in the underlying service are automatically lifted into Future.exception.
another filter to follow after this one
Conditionally propagates requests down the filter chain.
Conditionally propagates requests down the filter chain. This may useful if you are statically wiring together filter chains based on a configuration file, for instance.
a tuple of boolean and filter.
A Filter acts as a decorator/transformer of a service. It may apply transformations to the input and output of that service:
(* MyService *) [ReqIn -> (ReqOut -> RepIn) -> RepOut]
For example, you may have a POJO service that takes Strings and parses them as Ints. If you want to expose this as a Network Service via Thrift, it is nice to isolate the protocol handling from the business rules. Hence you might have a Filter that converts back and forth between Thrift structs. Again, your service deals with POJOs:
[ThriftIn -> (String -> Int) -> ThriftOut]
Thus, a Filter[A, B, C, D] converts a Service[C, D] to a Service[A, B]. In other words, it converts a Service[ReqOut, RepIn] to a Service[ReqIn, RepOut].