Class SampleFilter

  • All Implemented Interfaces:
    org.forgerock.http.Filter

    public class SampleFilter
    extends Object
    implements org.forgerock.http.Filter
    Filter to set a header in the incoming request and in the outgoing response.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SampleFilter.Heaplet
      Create and initialize the filter, based on the configuration.
    • Constructor Summary

      Constructors 
      Constructor Description
      SampleFilter()  
    • Constructor Detail

      • SampleFilter

        public SampleFilter()
    • Method Detail

      • filter

        public org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,​org.forgerock.util.promise.NeverThrowsException> filter​(org.forgerock.services.context.Context context,
                                                                                                                                                     org.forgerock.http.protocol.Request request,
                                                                                                                                                     org.forgerock.http.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 org.forgerock.http.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.