Interface TrailersTransformer<State,​Payload>

  • Type Parameters:
    State - Type of state provided by this transformer.
    Payload - Type of payload this transformer receives.
    All Known Implementing Classes:
    StatelessTrailersTransformer

    public interface TrailersTransformer<State,​Payload>
    A contract for transforming trailers for a streaming HTTP request/response.
    • Method Detail

      • payloadComplete

        HttpHeaders payloadComplete​(@Nullable
                                    State state,
                                    HttpHeaders trailers)
        Invoked once all TrailersTransformer instances are accepted and the payload stream has successfully completed.
        Parameters:
        state - TrailersTransformer instance created previously by this transformer.
        trailers - Trailer for the streaming HTTP request/response that is transformed.
        Returns:
        Potentially transformed trailers.
      • catchPayloadFailure

        HttpHeaders catchPayloadFailure​(@Nullable
                                        State state,
                                        java.lang.Throwable cause,
                                        HttpHeaders trailers)
                                 throws java.lang.Throwable
        Invoked once all TrailersTransformer instances are accepted and the payload stream has terminated with an error.

        This method suppresses the passed cause if it returns successfully. In order to propagate the cause, one should throw the same from this method.

        Parameters:
        state - TrailersTransformer instance created previously by this transformer.
        cause - of the payload stream failure.
        trailers - Trailer for the streaming HTTP request/response that is transformed.
        Returns:
        Potentially transformed trailers. This will swallow the passed cause. In order to propagate the cause, it should be re-thrown.
        Throws:
        java.lang.Throwable - If the error has to be propagated