Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 58 additions & 9 deletions src/main/java/io/vertx/core/http/HttpServerResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,25 +519,46 @@ default HttpServerResponse sendFile(String filename, long offset, Handler<AsyncR

/**
* Like {@link #push(HttpMethod, String, String, MultiMap, Handler)} with no headers.
*
* @deprecated instead use {@link #push(HttpMethod, HostAndPort, String, Handler)}
*/
@Deprecated
@Fluent
default HttpServerResponse push(HttpMethod method, String host, String path, Handler<AsyncResult<HttpServerResponse>> handler) {
return push(method, host, path, null, handler);
}

/**
* Same as {@link #push(HttpMethod, String, String, Handler)} but with an {@code handler} called when the operation completes
*
* @deprecated instead use {@link #push(HttpMethod, HostAndPort, String)}
*/
@Deprecated
default Future<HttpServerResponse> push(HttpMethod method, String host, String path) {
return push(method, host, path, (MultiMap) null);
}

/**
* Like {@link #push(HttpMethod, String, String, MultiMap, Handler)} with no headers.
*/
@Fluent
default HttpServerResponse push(HttpMethod method, HostAndPort host, String path, Handler<AsyncResult<HttpServerResponse>> handler) {
return push(method, host, path, null, handler);
}

/**
* Same as {@link #push(HttpMethod, String, String, Handler)} but with an {@code handler} called when the operation completes
*/
default Future<HttpServerResponse> push(HttpMethod method, HostAndPort host, String path) {
return push(method, host, path, (MultiMap) null);
}

/**
* Like {@link #push(HttpMethod, String, String, MultiMap, Handler)} with the host copied from the current request.
*/
@Fluent
default HttpServerResponse push(HttpMethod method, String path, MultiMap headers, Handler<AsyncResult<HttpServerResponse>> handler) {
return push(method, null, path, headers, handler);
return push(method, (String) null, path, headers, handler);
}

/**
Expand All @@ -552,14 +573,14 @@ default Future<HttpServerResponse> push(HttpMethod method, String path, MultiMap
*/
@Fluent
default HttpServerResponse push(HttpMethod method, String path, Handler<AsyncResult<HttpServerResponse>> handler) {
return push(method, null, path, null, handler);
return push(method, (String) null, path, null, handler);
}

/**
* Same as {@link #push(HttpMethod, String, Handler)} but with an {@code handler} called when the operation completes
*/
default Future<HttpServerResponse> push(HttpMethod method, String path) {
return push(method, null, path);
return push(method, (String) null, path);
}

/**
Expand All @@ -574,12 +595,13 @@ default Future<HttpServerResponse> push(HttpMethod method, String path) {
* Push can be sent only for peer initiated streams and if the response is not ended.
*
* @param method the method of the promised request
* @param authority the authority of the promised request
* @param host the authority of the promised request
* @param path the path of the promised request
* @param headers the headers of the promised request
* @param handler the handler notified when the response can be written
* @return a reference to this, so the API can be used fluently
*/
@Deprecated
@Fluent
default HttpServerResponse push(HttpMethod method, String host, String path, MultiMap headers, Handler<AsyncResult<HttpServerResponse>> handler) {
Future<HttpServerResponse> fut = push(method, host, path, headers);
Expand All @@ -589,11 +611,6 @@ default HttpServerResponse push(HttpMethod method, String host, String path, Mul
return this;
}

/**
* Same as {@link #push(HttpMethod, String, String, MultiMap, Handler)} but with an {@code handler} called when the operation completes
*/
Future<HttpServerResponse> push(HttpMethod method, HostAndPort authority, String path, MultiMap headers);

/**
* Push a response to the client.<p/>
*
Expand All @@ -615,6 +632,38 @@ default HttpServerResponse push(HttpMethod method, String host, String path, Mul
@Deprecated
Future<HttpServerResponse> push(HttpMethod method, String host, String path, MultiMap headers);

/**
* Push a response to the client.<p/>
*
* The {@code handler} will be notified with a <i>success</i> when the push can be sent and with
* a <i>failure</i> when the client has disabled push or reset the push before it has been sent.<p/>
*
* The {@code handler} may be queued if the client has reduced the maximum number of streams the server can push
* concurrently.<p/>
*
* Push can be sent only for peer initiated streams and if the response is not ended.
*
* @param method the method of the promised request
* @param authority the authority of the promised request
* @param path the path of the promised request
* @param headers the headers of the promised request
* @param handler the handler notified when the response can be written
* @return a reference to this, so the API can be used fluently
*/
@Fluent
default HttpServerResponse push(HttpMethod method, HostAndPort authority, String path, MultiMap headers, Handler<AsyncResult<HttpServerResponse>> handler) {
Future<HttpServerResponse> fut = push(method, authority, path, headers);
if (handler != null) {
fut.onComplete(handler);
}
return this;
}

/**
* Same as {@link #push(HttpMethod, String, String, MultiMap, Handler)} but with an {@code handler} called when the operation completes
*/
Future<HttpServerResponse> push(HttpMethod method, HostAndPort authority, String path, MultiMap headers);

/**
* Reset this HTTP/2 stream with the error code {@code 0}.
*/
Expand Down
Loading