Package io.servicetalk.http.api
Class StatelessTrailersTransformer<Payload>
java.lang.Object
io.servicetalk.http.api.StatelessTrailersTransformer<Payload>
- Type Parameters:
Payload
- Type of payload this transformer receives.
- All Implemented Interfaces:
TrailersTransformer<Void,
Payload>
public class StatelessTrailersTransformer<Payload>
extends Object
implements TrailersTransformer<Void,Payload>
An implementation of
TrailersTransformer
that does not require any state.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Payload
Accepts aTrailersTransformer
.protected Payload
Same asaccept(Void, Object)
but without the state.final HttpHeaders
catchPayloadFailure
(Void __, Throwable cause, HttpHeaders trailers) Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has terminated with an error.final Void
newState()
Creates a new instance of theTrailersTransformer
.protected HttpHeaders
payloadComplete
(HttpHeaders trailers) Same aspayloadComplete(Void, HttpHeaders)
but without the state.final HttpHeaders
payloadComplete
(Void __, HttpHeaders trailers) Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has successfully completed.protected HttpHeaders
payloadFailed
(Throwable cause, HttpHeaders trailers) Same ascatchPayloadFailure(Void, Throwable, HttpHeaders)
but without the state.
-
Constructor Details
-
StatelessTrailersTransformer
public StatelessTrailersTransformer()
-
-
Method Details
-
newState
Description copied from interface:TrailersTransformer
Creates a new instance of theTrailersTransformer
.- Specified by:
newState
in interfaceTrailersTransformer<Void,
Payload> - Returns:
- A new instance of the
TrailersTransformer
.
-
accept
Description copied from interface:TrailersTransformer
Accepts aTrailersTransformer
.- Specified by:
accept
in interfaceTrailersTransformer<Void,
Payload> - Parameters:
__
-TrailersTransformer
instance created previously by this transformer.payload
-TrailersTransformer
to accept.- Returns:
- Potentially transformed
TrailersTransformer
instance.
-
payloadComplete
Description copied from interface:TrailersTransformer
Invoked once allTrailersTransformer
instances areaccepted
and the payload stream has successfully completed.- Specified by:
payloadComplete
in interfaceTrailersTransformer<Void,
Payload> - Parameters:
__
-TrailersTransformer
instance created previously by this transformer.trailers
- Trailer for the streaming HTTP request/response that is transformed.- Returns:
- Potentially transformed trailers.
-
catchPayloadFailure
public final HttpHeaders catchPayloadFailure(Void __, Throwable cause, HttpHeaders trailers) throws Throwable Description copied from interface:TrailersTransformer
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.- Specified by:
catchPayloadFailure
in interfaceTrailersTransformer<Void,
Payload> - Parameters:
__
-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
-
accept
Same asaccept(Void, Object)
but without the state.- Parameters:
payload
-StatelessTrailersTransformer
to accept.- Returns:
- Potentially transformed
StatelessTrailersTransformer
instance.
-
payloadComplete
Same aspayloadComplete(Void, HttpHeaders)
but without the state.- Parameters:
trailers
- Trailer for the streaming HTTP request/response that is transformed.- Returns:
- Potentially transformed trailers.
-
payloadFailed
Same ascatchPayloadFailure(Void, Throwable, HttpHeaders)
but without the state.- Parameters:
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
-