Package io.servicetalk.http.api
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 Summary
Modifier and TypeMethodDescriptionAccepts aTrailersTransformer
.catchPayloadFailure
(State state, Throwable cause, HttpHeaders trailers) Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has terminated with an error.newState()
Creates a new instance of theTrailersTransformer
.payloadComplete
(State state, HttpHeaders trailers) Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has successfully completed.
-
Method Details
-
newState
Creates a new instance of theTrailersTransformer
.- Returns:
- A new instance of the
TrailersTransformer
.
-
accept
Accepts aTrailersTransformer
.- Parameters:
state
-TrailersTransformer
instance created previously by this transformer.payload
-TrailersTransformer
to accept.- Returns:
- Potentially transformed
TrailersTransformer
instance.
-
payloadComplete
Invoked once allTrailersTransformer
instances areaccepted
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 allTrailersTransformer
instances areaccepted
and the payload stream has terminated with an error.This method suppresses the passed
cause
if it returns successfully. In order to propagate thecause
, 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 thecause
, it should be re-thrown. - Throws:
Throwable
- If the error has to be propagated
-