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 Details

    • newState

      @Nullable State newState()
      Creates a new instance of the TrailersTransformer.
      Returns:
      A new instance of the TrailersTransformer.
    • accept

      Payload accept(@Nullable State state, Payload payload)
      Parameters:
      state - TrailersTransformer instance created previously by this transformer.
      payload - TrailersTransformer to accept.
      Returns:
      Potentially transformed TrailersTransformer instance.
    • 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, Throwable cause, HttpHeaders trailers) throws 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:
      Throwable - If the error has to be propagated