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