Hi,
I have question, can i work with jdk 1.7 or jdk 1.8 while using Jetty 9.4.8 version?
Also, if i override "onRequestFailure" method for callback then in that case how can i get the Throwable object from it or error?
@Override
public Request onRequestFailure(FailureListener listener) {
//ToDo
}
Regards,
Pratibha
Jetty 9.4.x requires JDK 8 or later.
request.onRequestFailure((Request request, Throwable failure) -> {
// Your code
});
Thanks a lot :+1:
Hello Simone,
I have few more questions:
1) Earlier we used to do like : bayeuxClient.setDebugEnabled(true);
But now this method is not available in bayeux-api-3.1.3
Could you please let me know if is there any alternate API for it?
2) ExecutorThreadPool pool = new ExecutorThreadPool(execSvc);
httpClient.setThreadPool(pool);
In the HttpClient there is no "setThreadPool" method is present so can i use like below:
httpClient.setExecutor(pool);
3) httpClient.setTimeout(timeout);
There is no setTimeout method is present now where timeout is the period in ms that an exchange will wait for a response from the server.
How can we do the same using latest HttpClient?
Regards,
Pratibha
Request.timeout(time, unit)Hello Simone,
Earlier we used to do like : exchange.waitForDone();
But how can we do the same thing with "request" object?
Regards,
Pratibha
Thanks Simone.
If i have a map
subscriberRequests.remove("anyname").abort();
What throwable object should i pass in the abort method, can i do like below:
subscriberRequests.remove("anyname").abort(new Exception());
Yes you can pass whatever Throwable you like.
Could you let me know what is the alternative method for "void onException(Throwable x) {}" in jetty 9.
Response.CompleteListener is the interface you want to implement to be notified of results.
The Result parameter tells you whether the request/response cycle completed successfully or not, and if not what are the failures.
Hello Simone,
Thanks for your quick responses. Could you please answer the below queries too :
1) ClientTransport had "TIMEOUT_OPTION" constant earlier but now in latest cometD library it is not present, could you please let us know to set the timeout value for ClientTransport?
2) We used to do ise isDone() for ContentExchange to check whether this exchange has been done or not but how can we do the same in case of Jetty 9 for HttpRequest??
3) As per the doc : https://wiki.eclipse.org/Jetty/Tutorial/HttpClient
We used to set the timeout value for client using "client.setTimeout(30000)"
How can we set it now using jetty 9, i do not want to set it to Request, while i want to set it to httpClient Object?
Or now it is default that if we won't set it also it will wait for 30 seconds?
Thanks,
Pratibha
ClientTransport did not have TIMEOUT_OPTION. That is a constant in AbstractServerTransport and it's still there.timeout, which you want to set on the CometD server, with the Jetty HttpClient timeout which is the max time the request/response cycle may last before being aborted.Hi Simone,
ClientTransport.TIMEOUT_OPTION was a constant that was not used and hence has been removed in later releases. I'm guessing whatever you were setting with that option had no effect.HttpClient.timeout property was controlling the total time an exchange could last. In Jetty 9.x this has been replaced by Request.timeout().This really helped ! Thanks a lot Simone.