use of com.atlassian.httpclient.api.HttpClient in project staf by simpleworks-gmbh.
the class AsynchronousHttpClientFactory method createClient.
@SuppressWarnings("static-method")
public DisposableHttpClient createClient(final URI serverUri, final AuthenticationHandler authenticationHandler) {
final HttpClientOptions options = new HttpClientOptions();
@SuppressWarnings({ "rawtypes", "unchecked" }) final DefaultHttpClientFactory defaultHttpClientFactory = new DefaultHttpClientFactory(new NoOpEventPublisher(), new RestClientApplicationProperties(serverUri), new ThreadLocalContextManager() {
@Override
public Object getThreadLocalContext() {
return null;
}
@Override
public void setThreadLocalContext(final Object context) {
// nothing to do.
}
@Override
public void clearThreadLocalContext() {
// nothing to do.
}
});
final HttpClient httpClient = defaultHttpClientFactory.create(options);
return new AtlassianHttpClientDecorator(httpClient, authenticationHandler) {
@Override
public void destroy() throws Exception {
defaultHttpClientFactory.dispose(httpClient);
}
};
}
use of com.atlassian.httpclient.api.HttpClient in project cx-flow by checkmarx-ltd.
the class CustomAsynchronousHttpClientFactory method createClientCustom.
@SuppressWarnings("unchecked")
public DisposableHttpClient createClientCustom(final URI serverUri, final AuthenticationHandler authenticationHandler, int socketTimeoutInMs) {
final HttpClientOptions options = new HttpClientOptions();
options.setSocketTimeout(socketTimeoutInMs, TimeUnit.MILLISECONDS);
options.setRequestTimeout(socketTimeoutInMs, TimeUnit.MILLISECONDS);
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);
}
};
}
use of com.atlassian.httpclient.api.HttpClient 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);
}
};
}
Aggregations