Class HttpRequestExecutorImpl
java.lang.Object
com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl
- All Implemented Interfaces:
HttpRequestExecutor
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bitbucket.jenkins.internal.client.HttpRequestExecutor
HttpRequestExecutor.ResponseConsumer<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic okhttp3.OkHttpClientvoidexecuteDelete(okhttp3.HttpUrl url, RequestConfiguration... additionalConfig) Executes a delete call.<T> TexecuteGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Executes a Get call to a given URL.<T> TexecutePost(okhttp3.HttpUrl url, String requestBodyAsJson, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Executes a POST with a given URL and request payload, with any custom headers.<T> TexecutePut(okhttp3.HttpUrl url, String requestBodyAsJson, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Executes a PUT with a given URL and request payload.executeStreamingGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<InputStream> consumer, RequestConfiguration... additionalConfig) Executes a streaming get call to a given URL.
-
Constructor Details
-
HttpRequestExecutorImpl
@Inject public HttpRequestExecutorImpl() -
HttpRequestExecutorImpl
public HttpRequestExecutorImpl(okhttp3.Call.Factory httpCallFactory)
-
-
Method Details
-
buildDefaultOkHttpClient
public static okhttp3.OkHttpClient buildDefaultOkHttpClient() -
executeDelete
Description copied from interface:HttpRequestExecutorExecutes a delete call.- Specified by:
executeDeletein interfaceHttpRequestExecutor- Parameters:
url- the delete urladditionalConfig- additional configuration, such as credentials, to use for deletion
-
executeGet
public <T> T executeGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Description copied from interface:HttpRequestExecutorExecutes a Get call to a given URL.- Specified by:
executeGetin interfaceHttpRequestExecutor- Type Parameters:
T- result that consumer wish to return- Parameters:
url- The URL to hit on bitbucket server endconsumer- on successful execution,Responsewill be passed to consumeradditionalConfig- additional configuration, such as credentials, that will be used in making calls- Returns:
- result
-
executePost
public <T> T executePost(okhttp3.HttpUrl url, String requestBodyAsJson, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Description copied from interface:HttpRequestExecutorExecutes a POST with a given URL and request payload, with any custom headers.- Specified by:
executePostin interfaceHttpRequestExecutor- Type Parameters:
T- result that consumer wish to return- Parameters:
url- The URL to hit on bitbucket server endrequestBodyAsJson- the request payload to send in JSON formatconsumer- on successful execution,Responsewill be passed to consumeradditionalConfig- additional configuration, such as credentials, that will be used in making calls- Returns:
- result computed by consumer
-
executeStreamingGet
public InputStream executeStreamingGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<InputStream> consumer, RequestConfiguration... additionalConfig) Description copied from interface:HttpRequestExecutorExecutes a streaming get call to a given URL.- Specified by:
executeStreamingGetin interfaceHttpRequestExecutor- Parameters:
url- The URL to hit on bitbucket server endconsumer- on successful execution,Responsewill be passed to consumeradditionalConfig- additional configuration, such as credentials, that will be used in making calls- Returns:
- result
-
executePut
public <T> T executePut(okhttp3.HttpUrl url, String requestBodyAsJson, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig) Description copied from interface:HttpRequestExecutorExecutes a PUT with a given URL and request payload.- Specified by:
executePutin interfaceHttpRequestExecutor- Type Parameters:
T- Type of result- Parameters:
url- The URL to hit on bitbucket server endrequestBodyAsJson- the request payload to send in JSON formatconsumer- on successful execution,Responsewill be passed to consumeradditionalConfig- additional configuration, such as credentials, that will be used in making calls- Returns:
- result computed by consumer
-