use of org.eclipse.jetty.client.HttpClient in project rpki-validator-3 by RIPE-NCC.
the class HttpRrdpClient method postConstruct.
@PostConstruct
public void postConstruct() throws Exception {
final SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setTrustAll(trustAllTlsCertificates);
httpClient = new HttpClient(sslContextFactory);
httpClient.start();
}
use of org.eclipse.jetty.client.HttpClient in project java-docs-samples by GoogleCloudPlatform.
the class AsyncRestServlet method init.
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
SslContextFactory sslContextFactory = new SslContextFactory();
client = new HttpClient(sslContextFactory);
try {
client.start();
} catch (Exception e) {
throw new ServletException(e);
}
}
use of org.eclipse.jetty.client.HttpClient in project learning-spark by databricks.
the class BasicMapPartitions method main.
public static void main(String[] args) throws Exception {
String master;
if (args.length > 0) {
master = args[0];
} else {
master = "local";
}
JavaSparkContext sc = new JavaSparkContext(master, "basicmappartitions", System.getenv("SPARK_HOME"), System.getenv("JARS"));
JavaRDD<String> rdd = sc.parallelize(Arrays.asList("KK6JKQ", "Ve3UoW", "kk6jlk", "W6BB"));
JavaRDD<String> result = rdd.mapPartitions(new FlatMapFunction<Iterator<String>, String>() {
public Iterable<String> call(Iterator<String> input) {
ArrayList<String> content = new ArrayList<String>();
ArrayList<ContentExchange> cea = new ArrayList<ContentExchange>();
HttpClient client = new HttpClient();
try {
client.start();
while (input.hasNext()) {
ContentExchange exchange = new ContentExchange(true);
exchange.setURL("http://qrzcq.com/call/" + input.next());
client.send(exchange);
cea.add(exchange);
}
for (ContentExchange exchange : cea) {
exchange.waitForDone();
content.add(exchange.getResponseContent());
}
} catch (Exception e) {
}
return content;
}
});
System.out.println(StringUtils.join(result.collect(), ","));
}
use of org.eclipse.jetty.client.HttpClient in project dropwizard by dropwizard.
the class AbstractHttp2Test method setUp.
@BeforeEach
void setUp() throws Exception {
sslContextFactory.setTrustStorePath(resourceFilePath("stores/http2_client.jts"));
sslContextFactory.setTrustStorePassword("http2_client");
sslContextFactory.start();
http1Client = new HttpClient(sslContextFactory);
http1Client.start();
http2Client = new HttpClient(new HttpClientTransportOverHTTP2(new HTTP2Client()), sslContextFactory);
http2Client.start();
}
use of org.eclipse.jetty.client.HttpClient in project cayenne by apache.
the class JettyHttpClientConnectionProvider method createJettyHttpRopConnector.
protected JettyHttpROPConnector createJettyHttpRopConnector() {
String url = runtimeProperties.get(ClientConstants.ROP_SERVICE_URL_PROPERTY);
if (url == null) {
throw new ConfigurationException("No property defined for '%s', can't initialize connection", ClientConstants.ROP_SERVICE_URL_PROPERTY);
}
String username = runtimeProperties.get(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY);
long readTimeout = runtimeProperties.getLong(ClientConstants.ROP_SERVICE_TIMEOUT_PROPERTY, -1L);
HttpClient httpClient = initJettyHttpClient();
addBasicAuthentication(httpClient, url, username);
JettyHttpROPConnector result = new JettyHttpROPConnector(httpClient, url, username);
if (readTimeout > 0) {
result.setReadTimeout(readTimeout);
}
return result;
}
Aggregations