I am using Jetty HTTP Client (v9.2.5) To Send HTTP Request It is Work Fine For HTTP Request {Post,Get,...} But When I send HTTPS Request Post I See This
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:642)
My Function Is
private Object sendHttpPOSTRequest(String url, List<Header> headers,
String content, HttpMethod method) {
try {
HttpClient client = new HttpClient();
client.setMaxConnectionsPerDestination(16);
client.setAddressResolutionTimeout(5000);
client.setConnectTimeout(5000);
client.setMaxRedirects(3);
client.setFollowRedirects(true);
client.setExecutor(_executor);
client.start();
Request req = client.POST(url).content(
new StringContentProvider(content));
if (headers != null)
req = setHeaders(req, headers);
req.header(HttpHeader.CONTENT_TYPE, "application/json");
return req.send();
} catch (Exception e) {
e.printStackTrace();
return "Failed";
}
}
Whats Wrong?