Package com.stripe.net
Class HttpClient
java.lang.Object
com.stripe.net.HttpClient
- Direct Known Subclasses:
HttpURLConnectionClient
Base abstract class for HTTP clients used to send requests to Stripe's API.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static String
Builds the value of theUser-Agent
header.protected static String
Builds the value of theX-Stripe-Client-User-Agent
header.abstract StripeResponse
request
(StripeRequest request) Sends the given request to Stripe's API, buffering the response body into memory.requestStream
(StripeRequest request) Sends the given request to Stripe's API, streaming the response body.requestStreamWithRetries
(StripeRequest request) Sends the given request to Stripe's API, streaming the response, retrying the request in cases of intermittent problems.requestStreamWithTelemetry
(StripeRequest request) Deprecated.requestWithRetries
(StripeRequest request) Sends the given request to Stripe's API, retrying the request in cases of intermittent problems.requestWithTelemetry
(StripeRequest request) Deprecated.Userequest(StripeRequest)
instead.<T extends com.stripe.net.AbstractStripeResponse<?>>
TsendWithRetries
(StripeRequest request, com.stripe.net.HttpClient.RequestSendFunction<T> send)
-
Field Details
-
maxNetworkRetriesDelay
Maximum sleep time between tries to send HTTP requests after network failure. -
minNetworkRetriesDelay
Minimum sleep time between tries to send HTTP requests after network failure.
-
-
Constructor Details
-
HttpClient
protected HttpClient()Initializes a new instance of theHttpClient
class.
-
-
Method Details
-
request
Sends the given request to Stripe's API, buffering the response body into memory.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
requestStream
Sends the given request to Stripe's API, streaming the response body.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
requestWithTelemetry
@Deprecated public StripeResponse requestWithTelemetry(StripeRequest request) throws StripeException Deprecated.Userequest(StripeRequest)
instead.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
requestStreamWithTelemetry
@Deprecated public StripeResponseStream requestStreamWithTelemetry(StripeRequest request) throws StripeException Deprecated.UserequestStream(StripeRequest)
instead.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
sendWithRetries
public <T extends com.stripe.net.AbstractStripeResponse<?>> T sendWithRetries(StripeRequest request, com.stripe.net.HttpClient.RequestSendFunction<T> send) throws StripeException - Throws:
StripeException
-
requestWithRetries
Sends the given request to Stripe's API, retrying the request in cases of intermittent problems.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
requestStreamWithRetries
Sends the given request to Stripe's API, streaming the response, retrying the request in cases of intermittent problems.- Parameters:
request
- the request- Returns:
- the response
- Throws:
StripeException
- If the request fails for any reason
-
buildUserAgentString
Builds the value of theUser-Agent
header.- Returns:
- a string containing the value of the
User-Agent
header
-
buildXStripeClientUserAgentString
Builds the value of theX-Stripe-Client-User-Agent
header.- Returns:
- a string containing the value of the
X-Stripe-Client-User-Agent
header
-
requestStream(StripeRequest)
instead.