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 Payload
accept(State state, Payload payload)
Accepts aTrailersTransformer
.HttpHeaders
catchPayloadFailure(State state, java.lang.Throwable cause, HttpHeaders trailers)
Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has terminated with an error.State
newState()
Creates a new instance of theTrailersTransformer
.HttpHeaders
payloadComplete(State state, HttpHeaders trailers)
Invoked once allTrailersTransformer
instances areaccepted
and 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
-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 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, java.lang.Throwable cause, HttpHeaders trailers) throws java.lang.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:
java.lang.Throwable
- If the error has to be propagated
-
-