Package io.servicetalk.http.api
Class HttpApiConversions
- java.lang.Object
-
- io.servicetalk.http.api.HttpApiConversions
-
public final class HttpApiConversions extends java.lang.Object
Conversion routines toStreamingHttpService
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
HttpApiConversions.ServiceAdapterHolder
A holder forStreamingHttpService
that adapts anotherservice
to the streaming programming model.
-
Method Summary
-
-
-
Method Detail
-
toReservedConnection
public static ReservedHttpConnection toReservedConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnection
toReservedHttpConnection
.- Parameters:
original
-ReservedStreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedReservedHttpConnection
- Returns:
- The conversion result.
-
toReservedBlockingConnection
public static ReservedBlockingHttpConnection toReservedBlockingConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnection
toReservedBlockingHttpConnection
.- Parameters:
original
-ReservedStreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedReservedBlockingHttpConnection
- Returns:
- The conversion result.
-
toReservedBlockingStreamingConnection
public static ReservedBlockingStreamingHttpConnection toReservedBlockingStreamingConnection(ReservedStreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromReservedStreamingHttpConnection
toReservedBlockingStreamingHttpConnection
.- Parameters:
original
-ReservedStreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedReservedBlockingStreamingHttpConnection
- Returns:
- The conversion result.
-
toConnection
public static HttpConnection toConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnection
toHttpConnection
.- Parameters:
original
-StreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedHttpConnection
- Returns:
- The conversion result.
-
toBlockingConnection
public static BlockingHttpConnection toBlockingConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnection
toBlockingHttpConnection
.- Parameters:
original
-StreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedBlockingHttpConnection
- Returns:
- The conversion result.
-
toBlockingStreamingConnection
public static BlockingStreamingHttpConnection toBlockingStreamingConnection(StreamingHttpConnection original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpConnection
toBlockingStreamingHttpConnection
.- Parameters:
original
-StreamingHttpConnection
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedBlockingStreamingHttpConnection
- Returns:
- The conversion result.
-
toClient
public static HttpClient toClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClient
toHttpClient
.- Parameters:
original
-StreamingHttpClient
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedHttpClient
- Returns:
- The conversion result.
-
toBlockingClient
public static BlockingHttpClient toBlockingClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClient
toBlockingHttpClient
.- Parameters:
original
-StreamingHttpClient
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedBlockingHttpClient
- Returns:
- The conversion result.
-
toBlockingStreamingClient
public static BlockingStreamingHttpClient toBlockingStreamingClient(StreamingHttpClient original, HttpExecutionStrategyInfluencer influencer)
Convert fromStreamingHttpClient
toBlockingStreamingHttpClient
.- Parameters:
original
-StreamingHttpClient
to convert.influencer
-HttpExecutionStrategyInfluencer
to use to derive the strategy of the returnedBlockingStreamingHttpClient
- Returns:
- The conversion result.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(HttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aHttpService
to aStreamingHttpService
.- Parameters:
service
- TheHttpService
to convert.influencer
-HttpExecutionStrategyInfluencer
to influence the strategy for invoking the resultingStreamingHttpService
.- Returns:
HttpApiConversions.ServiceAdapterHolder
containing the service adapted to the streaming programming model.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(BlockingStreamingHttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aBlockingStreamingHttpService
to aStreamingHttpService
.- Parameters:
service
- TheBlockingStreamingHttpService
to convert.influencer
-HttpExecutionStrategyInfluencer
to influence the strategy for invoking the resultingStreamingHttpService
.- Returns:
HttpApiConversions.ServiceAdapterHolder
containing the service adapted to the streaming programming model.
-
toStreamingHttpService
public static HttpApiConversions.ServiceAdapterHolder toStreamingHttpService(BlockingHttpService service, HttpExecutionStrategyInfluencer influencer)
Convert from aBlockingStreamingHttpService
to aStreamingHttpService
.- Parameters:
service
- TheBlockingStreamingHttpService
to convert.influencer
-HttpExecutionStrategyInfluencer
to influence the strategy for invoking the resultingStreamingHttpService
.- Returns:
HttpApiConversions.ServiceAdapterHolder
containing the service adapted to the streaming programming model.
-
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:
true
is the request/response payload is safe to aggregate,false
otherwise.
-
mayHaveTrailers
public static boolean mayHaveTrailers(HttpMetaData metadata)
Checks whether a request/response payload may have trailers.- Parameters:
metadata
- The request/response to check.- Returns:
true
is the request/response payload may have trailers,false
otherwise.
-
toBlockingHttpService
public static BlockingHttpService toBlockingHttpService(StreamingHttpService service)
Convert from aStreamingHttpService
to aBlockingHttpService
.- Parameters:
service
- TheStreamingHttpService
to convert.- Returns:
- The conversion result.
-
toHttpService
public static HttpService toHttpService(StreamingHttpService service)
Convert from aStreamingHttpService
to aHttpService
.- Parameters:
service
- TheStreamingHttpService
to convert.- Returns:
- The conversion result.
-
toBlockingStreamingHttpService
public static BlockingStreamingHttpService toBlockingStreamingHttpService(StreamingHttpService service)
Convert from aStreamingHttpService
to aBlockingStreamingHttpService
.- Parameters:
service
- TheStreamingHttpService
to convert.- Returns:
- The conversion result.
-
-