List of usage examples for org.apache.http.impl.client HttpClientBuilder create
public static HttpClientBuilder create()
From source file:eu.delving.sip.base.HttpClientFactory.java
public static HttpClient createLinkCheckClient() { return HttpClientBuilder.create().disableAutomaticRetries().build(); }
From source file:wercker4j.http.DefaultHttpConfig.java
/** * createHttpClient will get defaultClient * * @param token token to access the wercker API * @return HttpClient/*w w w . j a v a2 s .c o m*/ */ public static CloseableHttpClient createHttpClient(String token) { List<Header> headers = new ArrayList<Header>(); headers.add(new BasicHeader("Content-Type", "application/json")); headers.add(new BasicHeader("Authorization", "Bearer " + token)); return HttpClientBuilder.create().setDefaultHeaders(headers).build(); }
From source file:ninja.siden.internal.Testing.java
static CloseableHttpClient client() { HttpClientBuilder builder = HttpClientBuilder.create(); builder.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(200).build()); builder.setRetryHandler(new DefaultHttpRequestRetryHandler(0, false)); return builder.build(); }
From source file:org.eclipse.packagedrone.testing.server.channel.UploadApiV2Test.java
@BeforeClass public static void setup() { httpclient = HttpClientBuilder.create().build(); }
From source file:org.apache.heron.integration_topology_test.core.HttpUtils.java
public static int httpJsonPost(String newHttpPostUrl, String jsonData) throws IOException, ParseException { HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost(newHttpPostUrl); StringEntity requestEntity = new StringEntity(jsonData, ContentType.APPLICATION_JSON); post.setEntity(requestEntity);/* ww w.j av a2 s. c o m*/ HttpResponse response = client.execute(post); return response.getStatusLine().getStatusCode(); }
From source file:com.mvn.aircraft.ApiTest.java
@Test public static void testMimeType(String restURL, String expectedMimeType) throws ClientProtocolException, IOException { HttpUriRequest request = new HttpGet(restURL); HttpResponse httpResponse = (HttpResponse) HttpClientBuilder.create().build().execute(request); Assert.assertEquals(expectedMimeType, ContentType.getOrDefault((HttpEntity) httpResponse.getStatus()).getMimeType()); }
From source file:eu.delving.sip.base.HttpClientFactory.java
public static HttpClient createHttpClient(File storageDirectory) { HttpClientBuilder builder = HttpClientBuilder.create().disableAutomaticRetries(); builder.setConnectionManager(new PoolingHttpClientConnectionManager()); if (!StorageFinder.isStandalone(storageDirectory)) { String serverUrl = String.format("http://%s", getHostPort(storageDirectory)); handleProxy(serverUrl, builder); }/* w w w. j av a 2 s. co m*/ return builder.build(); }
From source file:com.esri.geoportal.commons.robots.BotsUtils.java
/** * Gets default parser//from www. j a v a2s .c o m * @return default parser (never <code>null</code>) */ public static BotsParser parser() { return parser(BotsConfig.DEFAULT, HttpClientBuilder.create().useSystemProperties().build()); }
From source file:eu.esdihumboldt.hale.common.cache.ClientUtil.java
/** * Create a thread safe HTTP client//w w w . ja va 2 s .com * * @return the created HTTP client */ public static HttpClientBuilder threadSafeHttpClientBuilder() { // create HTTP client builder PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); return HttpClientBuilder.create().setConnectionManager(cm); }
From source file:org.alfresco.selenium.FetchHttpClient.java
public static CloseableHttpClient getHttpClient(final WebDriver driver) { BasicCookieStore cookieStore = new BasicCookieStore(); cookieStore.addCookie(generateSessionCookie(driver)); //Create http client to retrieve the file. return HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build(); }