List of usage examples for io.vertx.core.http HttpClientRequest pushHandler
@Fluent HttpClientRequest pushHandler(Handler<HttpClientRequest> handler);
From source file:examples.HTTP2Examples.java
License:Open Source License
public void example13(HttpClient client) { HttpClientRequest request = client.get("/index.html", response -> { // Process index.html response });//from w w w . ja va2 s .c o m // Set a push handler to be aware of any resource pushed by the server request.pushHandler(pushedRequest -> { // A resource is pushed for this request System.out.println("Server pushed " + pushedRequest.path()); // Set an handler for the response pushedRequest.handler(pushedResponse -> { System.out.println("The response for the pushed request"); }); }); // End the request request.end(); }
From source file:examples.HTTP2Examples.java
License:Open Source License
public void example14(HttpClientRequest request) { request.pushHandler(pushedRequest -> { if (pushedRequest.path().equals("/main.js")) { pushedRequest.reset();/*from w w w . ja v a2s .c o m*/ } else { // Handle it } }); }