Search in sources :

Example 1 with AtlassianHttpClientDecorator

use of com.atlassian.jira.rest.client.internal.async.AtlassianHttpClientDecorator in project jira-plugin by jenkinsci.

the class JiraSite method createClient.

private static DisposableHttpClient createClient(final URI serverUri, final AuthenticationHandler authenticationHandler, HttpClientOptions options) {
    final DefaultHttpClientFactory defaultHttpClientFactory = new DefaultHttpClientFactory(new NoOpEventPublisher(), new RestClientApplicationProperties(serverUri), new ThreadLocalContextManager() {

        @Override
        public Object getThreadLocalContext() {
            return null;
        }

        @Override
        public void setThreadLocalContext(Object context) {
        }

        @Override
        public void clearThreadLocalContext() {
        }
    });
    final HttpClient httpClient = defaultHttpClientFactory.create(options);
    return new AtlassianHttpClientDecorator(httpClient, authenticationHandler) {

        @Override
        public void destroy() throws Exception {
            defaultHttpClientFactory.dispose(httpClient);
        }
    };
}
Also used : DefaultHttpClientFactory(com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory) HttpClient(com.atlassian.httpclient.api.HttpClient) DisposableHttpClient(com.atlassian.jira.rest.client.internal.async.DisposableHttpClient) ThreadLocalContextManager(com.atlassian.sal.api.executor.ThreadLocalContextManager) AtlassianHttpClientDecorator(com.atlassian.jira.rest.client.internal.async.AtlassianHttpClientDecorator)

Aggregations

DefaultHttpClientFactory (com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory)1 HttpClient (com.atlassian.httpclient.api.HttpClient)1 AtlassianHttpClientDecorator (com.atlassian.jira.rest.client.internal.async.AtlassianHttpClientDecorator)1 DisposableHttpClient (com.atlassian.jira.rest.client.internal.async.DisposableHttpClient)1 ThreadLocalContextManager (com.atlassian.sal.api.executor.ThreadLocalContextManager)1