Package io.servicetalk.http.api
Class HttpApiConversions
- java.lang.Object
-
- io.servicetalk.http.api.HttpApiConversions
-
public final class HttpApiConversions extends java.lang.ObjectConversion routines toStreamingHttpService.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHttpApiConversions.ServiceAdapterHolderA holder forStreamingHttpServicethat adapts anotherserviceto the streaming programming model.
-
Method Summary
-
-
-
Method Detail
-
toReservedConnection
public static ReservedHttpConnection toReservedConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnectiontoReservedHttpConnection.- Parameters:
original-ReservedStreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedReservedHttpConnection- Returns:
- The conversion result.
-
toReservedBlockingConnection
public static ReservedBlockingHttpConnection toReservedBlockingConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnectiontoReservedBlockingHttpConnection.- Parameters:
original-ReservedStreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedReservedBlockingHttpConnection- Returns:
- The conversion result.
-
toReservedBlockingStreamingConnection
public static ReservedBlockingStreamingHttpConnection toReservedBlockingStreamingConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnectiontoReservedBlockingStreamingHttpConnection.- Parameters:
original-ReservedStreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedReservedBlockingStreamingHttpConnection- Returns:
- The conversion result.
-
toConnection
public static HttpConnection toConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnectiontoHttpConnection.- Parameters:
original-StreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedHttpConnection- Returns:
- The conversion result.
-
toBlockingConnection
public static BlockingHttpConnection toBlockingConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnectiontoBlockingHttpConnection.- Parameters:
original-StreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedBlockingHttpConnection- Returns:
- The conversion result.
-
toBlockingStreamingConnection
public static BlockingStreamingHttpConnection toBlockingStreamingConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnectiontoBlockingStreamingHttpConnection.- Parameters:
original-StreamingHttpConnectionto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedBlockingStreamingHttpConnection- Returns:
- The conversion result.
-
toClient
public static HttpClient toClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClienttoHttpClient.- Parameters:
original-StreamingHttpClientto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedHttpClient- Returns:
- The conversion result.
-
toBlockingClient
public static BlockingHttpClient toBlockingClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClienttoBlockingHttpClient.- Parameters:
original-StreamingHttpClientto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedBlockingHttpClient- Returns:
- The conversion result.
-
toBlockingStreamingClient
public static BlockingStreamingHttpClient toBlockingStreamingClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClienttoBlockingStreamingHttpClient.- Parameters:
original-StreamingHttpClientto convert.influencer-HttpExecutionStrategyInfluencerto use to derive the strategy of the returnedBlockingStreamingHttpClient- Returns:
- The conversion result.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(HttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aHttpServiceto aStreamingHttpService.- Parameters:
service- TheHttpServiceto convert.influencer-HttpExecutionStrategyInfluencerto influence the strategy for invoking the resultingStreamingHttpService.- Returns:
HttpApiConversions.ServiceAdapterHoldercontaining the service adapted to the streaming programming model.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(BlockingStreamingHttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aBlockingStreamingHttpServiceto aStreamingHttpService.- Parameters:
service- TheBlockingStreamingHttpServiceto convert.influencer-HttpExecutionStrategyInfluencerto influence the strategy for invoking the resultingStreamingHttpService.- Returns:
HttpApiConversions.ServiceAdapterHoldercontaining the service adapted to the streaming programming model.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(BlockingHttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aBlockingStreamingHttpServiceto aStreamingHttpService.- Parameters:
service- TheBlockingStreamingHttpServiceto convert.influencer-HttpExecutionStrategyInfluencerto influence the strategy for invoking the resultingStreamingHttpService.- Returns:
HttpApiConversions.ServiceAdapterHoldercontaining the service adapted to the streaming programming model.
-
isPayloadEmpty
public static boolean isPayloadEmpty(HttpMetaData metadata)
Checks whether a request/response payload body is empty.- Parameters:
metadata- The request/response to check.- Returns:
trueis the request/response payload body is empty,falseotherwise.
-
isSafeToAggregate
public static boolean isSafeToAggregate(HttpMetaData metadata)
Checks whether a request/response payload is safe to aggregate, which may allow for writing a `content-length` header.- Parameters:
metadata- The request/response to check.- Returns:
trueis the request/response payload is safe to aggregate,falseotherwise.
-
mayHaveTrailers
public static boolean mayHaveTrailers(HttpMetaData metadata)
Checks whether a request/response payload may have trailers.- Parameters:
metadata- The request/response to check.- Returns:
trueis the request/response payload may have trailers,falseotherwise.
-
toBlockingHttpService
public static BlockingHttpService toBlockingHttpService(StreamingHttpService service)
Convert from aStreamingHttpServiceto aBlockingHttpService.- Parameters:
service- TheStreamingHttpServiceto convert.- Returns:
- The conversion result.
-
toHttpService
public static HttpService toHttpService(StreamingHttpService service)
Convert from aStreamingHttpServiceto aHttpService.- Parameters:
service- TheStreamingHttpServiceto convert.- Returns:
- The conversion result.
-
toBlockingStreamingHttpService
public static BlockingStreamingHttpService toBlockingStreamingHttpService(StreamingHttpService service)
Convert from aStreamingHttpServiceto aBlockingStreamingHttpService.- Parameters:
service- TheStreamingHttpServiceto convert.- Returns:
- The conversion result.
-
-