Class SampleFilter

  • All Implemented Interfaces:
    Filter

    public class SampleFilter
    extends Object
    implements Filter
    Filter to set a header in the incoming request and in the outgoing response.
    • Constructor Detail

      • SampleFilter

        public SampleFilter()
    • Method Detail

      • filter

        public Promise<Response,​NeverThrowsException> filter​(Context context,
                                                                   Request request,
                                                                   Handler next)
        Set a header in the incoming request and in the outgoing response. A configuration example looks something like the following.
         {
             "name": "SampleFilter",
             "type": "SampleFilter",
             "config": {
                 "name": "X-Greeting",
                 "value": "Hello world"
             }
         }
         
        Specified by:
        filter in interface Filter
        Parameters:
        context - Execution context.
        request - HTTP Request.
        next - Next filter or handler in the chain.
        Returns:
        A Promise representing the response to be returned to the client.