Interface Interceptor<R extends Request<?>,​S extends Response<?>>

  • Type Parameters:
    R - the request type
    S - the response type
    All Superinterfaces:
    ConfigurablePlugin, ExchangeTypeResolver<R,​S>, Plugin
    All Known Subinterfaces:
    BsonInterceptor, ByteArrayInterceptor, JsonInterceptor, MongoInterceptor, ProxyInterceptor

    public interface Interceptor<R extends Request<?>,​S extends Response<?>>
    extends ConfigurablePlugin, ExchangeTypeResolver<R,​S>
    Interceptors allow to snoop and modify requests and responses at different stages of the request lifecycle as defined by the interceptPoint parameter of the annotation RegisterPlugin. @see org.restheart.plugins.InterceptPoint An interceptor can intercept either proxied requests or requests handled by Services. An interceptor can intercept requests handled by a Service when its request and response types are equal to the ones declared by the Service. An interceptor can intercept a proxied request, when its request and response types extends BufferedRequest and BufferedResponse.
    Author:
    Andrea Di Cesare
    • Method Detail

      • handle

        void handle​(R request,
                    S response)
             throws Exception
        handle the request
        Parameters:
        request -
        response -
        Throws:
        Exception
      • resolve

        boolean resolve​(R request,
                        S response)
        Parameters:
        request -
        response -
        Returns:
        true if the plugin must handle the request