Class HttpRequestExecutorImpl
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl
-
- All Implemented Interfaces:
HttpRequestExecutor
public class HttpRequestExecutorImpl extends Object implements HttpRequestExecutor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bitbucket.jenkins.internal.client.HttpRequestExecutor
HttpRequestExecutor.ResponseConsumer<T>
-
-
Constructor Summary
Constructors Constructor Description HttpRequestExecutorImpl()
HttpRequestExecutorImpl(okhttp3.Call.Factory httpCallFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static okhttp3.OkHttpClient
buildDefaultOkHttpClient()
void
executeDelete(okhttp3.HttpUrl url, RequestConfiguration... additionalConfig)
Executes a delete call.<T> T
executeGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig)
Executes a Get call to a given URL.<T> T
executePost(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> T
executePut(okhttp3.HttpUrl url, String requestBodyAsJson, HttpRequestExecutor.ResponseConsumer<T> consumer, RequestConfiguration... additionalConfig)
Executes a PUT with a given URL and request payload.InputStream
executeStreamingGet(okhttp3.HttpUrl url, HttpRequestExecutor.ResponseConsumer<InputStream> consumer, RequestConfiguration... additionalConfig)
Executes a streaming get call to a given URL.
-
-
-
Method Detail
-
buildDefaultOkHttpClient
public static okhttp3.OkHttpClient buildDefaultOkHttpClient()
-
executeDelete
public void executeDelete(okhttp3.HttpUrl url, RequestConfiguration... additionalConfig)
Description copied from interface:HttpRequestExecutor
Executes a delete call.- Specified by:
executeDelete
in 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:HttpRequestExecutor
Executes a Get call to a given URL.- Specified by:
executeGet
in interfaceHttpRequestExecutor
- Type Parameters:
T
- result that consumer wish to return- Parameters:
url
- The URL to hit on bitbucket server endconsumer
- on successful execution,Response
will 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:HttpRequestExecutor
Executes a POST with a given URL and request payload, with any custom headers.- Specified by:
executePost
in 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,Response
will 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:HttpRequestExecutor
Executes a streaming get call to a given URL.- Specified by:
executeStreamingGet
in interfaceHttpRequestExecutor
- Parameters:
url
- The URL to hit on bitbucket server endconsumer
- on successful execution,Response
will 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:HttpRequestExecutor
Executes a PUT with a given URL and request payload.- Specified by:
executePut
in 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,Response
will be passed to consumeradditionalConfig
- additional configuration, such as credentials, that will be used in making calls- Returns:
- result computed by consumer
-
-