当前位置: 首页>>代码示例>>Java>>正文


Java Executor.execute方法代码示例

本文整理汇总了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());
}
 
开发者ID:IBMStreams,项目名称:streamsx.topology,代码行数:24,代码来源:StreamsRestUtils.java

示例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;
}
 
开发者ID:CognitiveBuild,项目名称:Chatbot,代码行数:6,代码来源:Utility.java

示例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));
}
 
开发者ID:Roboroxx,项目名称:itunesconnect-api,代码行数:5,代码来源:ItunesConnectLoginApi.java

示例5: session

import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
private void session(Executor executor) throws IOException {
    executor.execute(Request.Get(olympusUrl + SESSION_PATH));
}
 
开发者ID:Roboroxx,项目名称:itunesconnect-api,代码行数:4,代码来源:ItunesConnectLoginApi.java


注:本文中的org.apache.http.client.fluent.Executor.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。