Package com.linecorp.armeria.common.grpc
Class GrpcWebTrailers
java.lang.Object
com.linecorp.armeria.common.grpc.GrpcWebTrailers
Deprecated.
Retrieves gRPC-Web trailers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable HttpHeaders
get
(RequestContext ctx) Deprecated.Returns the gRPC-Web trailers which was set to the specifiedRequestContext
usingset(RequestContext, HttpHeaders)
.static void
set
(RequestContext ctx, HttpHeaders trailers) Deprecated.Sets the specified gRPC-Web trailers to theRequestContext
.
-
Method Details
-
get
Deprecated.Returns the gRPC-Web trailers which was set to the specifiedRequestContext
usingset(RequestContext, HttpHeaders)
.A gRPC-Web response does not contain a separated trailers according to the gRPC-Web spec:
- Trailers must be the last message of the response.
- Trailers may be sent together with response headers, with no message in the body.
AggregatedHttpResponse.headers()
} or parsed fromAggregatedHttpObject.content()
.This method is useful when
RetryRuleWithContent
needsGrpcHeaderNames.GRPC_STATUS
to decide whether to retry. For example:GrpcClients.builder(grpcServerUri) .decorator(RetryingClient.newDecorator( RetryRuleWithContent.onResponse((ctx, response) -> { // Note that we should aggregate the response to get the trailers. return response.aggregate().thenApply(aggregated -> { HttpHeaders trailers = GrpcWebTrailers.get(ctx); // Retry if the 'grpc-status' is not equal to 0. return trailers != null && trailers.getInt(GrpcHeaderNames.GRPC_STATUS) != 0; }); }))) .build(MyGrpcStub.class);
-
set
Deprecated.Sets the specified gRPC-Web trailers to theRequestContext
.
-
GrpcWebTrailers
instead.