Class HttpRequestExecutorImpl

    • Constructor Detail

      • HttpRequestExecutorImpl

        @Inject
        public HttpRequestExecutorImpl()
      • HttpRequestExecutorImpl

        public HttpRequestExecutorImpl​(okhttp3.Call.Factory httpCallFactory)
    • 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 interface HttpRequestExecutor
        Parameters:
        url - the delete url
        additionalConfig - 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 interface HttpRequestExecutor
        Type Parameters:
        T - result that consumer wish to return
        Parameters:
        url - The URL to hit on bitbucket server end
        consumer - on successful execution, Response will be passed to consumer
        additionalConfig - 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 interface HttpRequestExecutor
        Type Parameters:
        T - result that consumer wish to return
        Parameters:
        url - The URL to hit on bitbucket server end
        requestBodyAsJson - the request payload to send in JSON format
        consumer - on successful execution, Response will be passed to consumer
        additionalConfig - additional configuration, such as credentials, that will be used in making calls
        Returns:
        result computed by consumer
      • 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 interface HttpRequestExecutor
        Type Parameters:
        T - Type of result
        Parameters:
        url - The URL to hit on bitbucket server end
        requestBodyAsJson - the request payload to send in JSON format
        consumer - on successful execution, Response will be passed to consumer
        additionalConfig - additional configuration, such as credentials, that will be used in making calls
        Returns:
        result computed by consumer