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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Payloadaccept(State state, Payload payload)Accepts aTrailersTransformer.HttpHeaderscatchPayloadFailure(State state, java.lang.Throwable cause, HttpHeaders trailers)Invoked once allTrailersTransformerinstances areacceptedand the payload stream has terminated with an error.StatenewState()Creates a new instance of theTrailersTransformer.HttpHeaderspayloadComplete(State state, HttpHeaders trailers)Invoked once allTrailersTransformerinstances areacceptedand the payload stream has successfully completed.
-
-
-
Method Detail
-
newState
@Nullable State newState()
Creates a new instance of theTrailersTransformer.- Returns:
- A new instance of the
TrailersTransformer.
-
accept
Payload accept(@Nullable State state, Payload payload)
Accepts aTrailersTransformer.- Parameters:
state-TrailersTransformerinstance created previously by this transformer.payload-TrailersTransformerto accept.- Returns:
- Potentially transformed
TrailersTransformerinstance.
-
payloadComplete
HttpHeaders payloadComplete(@Nullable State state, HttpHeaders trailers)
Invoked once allTrailersTransformerinstances areacceptedand the payload stream has successfully completed.- Parameters:
state-TrailersTransformerinstance 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 allTrailersTransformerinstances areacceptedand the payload stream has terminated with an error.This method suppresses the passed
causeif it returns successfully. In order to propagate thecause, one should throw the same from this method.- Parameters:
state-TrailersTransformerinstance 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:
java.lang.Throwable- If the error has to be propagated
-
-