本文整理汇总了Java中org.apache.http.client.fluent.Executor.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Executor.execute方法的具体用法?Java Executor.execute怎么用?Java Executor.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.client.fluent.Executor
的用法示例。
在下文中一共展示了Executor.execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testProxyAuthWithSSL
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
@Test
public void testProxyAuthWithSSL() throws Exception {
SSLContext sslContext = new SSLContextBuilder()
.loadTrustMaterial(new File(keyStoreFile), keystorePW.toCharArray(), new TrustSelfSignedStrategy())
.build();
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLContext(sslContext)
.setSSLHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
}).build()) {
Executor ex = Executor.newInstance(httpclient);
Response response = ex.execute(Request.Get("https://localhost:9200/blahobar.234324234/logs/1")
.addHeader("Authorization", String.format("Bearer %s", token))
.addHeader("X-Proxy-Remote-User", proxyUser));
System.out.println(response.returnContent().asString());
} catch (Exception e) {
System.out.println(e);
fail("Test Failed");
}
}
开发者ID:fabric8io,项目名称:openshift-elasticsearch-plugin,代码行数:26,代码来源:HttpsProxyClientCertAuthenticatorIntegrationTest.java
示例2: getGsonResponse
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
/**
* Gets a JSON response to an HTTP call
*
* @param executor HTTP client executor to use for call
* @param auth Authentication header contents, or null
* @param inputString
* REST call to make
* @return response from the inputString
* @throws IOException
*/
static JsonObject getGsonResponse(Executor executor, String auth, String inputString)
throws IOException {
Request request = Request
.Get(inputString)
.addHeader("accept", ContentType.APPLICATION_JSON.getMimeType())
.useExpectContinue();
if (null != auth) {
request = request.addHeader(AUTH.WWW_AUTH_RESP, auth);
}
Response response = executor.execute(request);
return gsonFromResponse(response.returnResponse());
}
示例3: invokeRequest
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
public static HttpResponse invokeRequest(Request request, Executor executor) throws ClientProtocolException, IOException {
Response response = executor.execute(request);
HttpResponse httpResponse = response.returnResponse();
return httpResponse;
}
示例4: signin
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
private void signin(Executor executor, String authServiceUrl, String authServiceKey, String login, String password) throws IOException {
final SigninRequest request = new SigninRequest(login, password, false);
executor.execute(Request.Post(authServiceUrl + SIGNIN_PATH).bodyString(objectMapper.writeValueAsString(request), ContentType.APPLICATION_JSON).addHeader("X-Apple-Widget-Key", authServiceKey));
}
示例5: session
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
private void session(Executor executor) throws IOException {
executor.execute(Request.Get(olympusUrl + SESSION_PATH));
}