Interface PushCapableHttpRequest<B>

Type Parameters:
B - The Http message body
All Superinterfaces:
AttributeHolder, HttpMessage<B>, HttpRequest<B>, MutableAttributeHolder
All Known Implementing Classes:

public interface PushCapableHttpRequest<B> extends HttpRequest<B>
A HttpRequest that is potentially capable of HTTP2 server push. Code should check isServerPushSupported() before attempting to send any server push.
Jonas Konrad
  • Method Details

    • isServerPushSupported

      boolean isServerPushSupported()
      Check whether HTTP2 server push is supported by the remote client. Only HTTP2 clients that indicate support through HTTP2 settings have this method return true.
      true iff server push is supported.
    • serverPush

      Initiate a HTTP2 server push for the given request. The information from the given request (i.e. path, headers) will be passed on to the client immediately so that it does not send the request itself. Then, the given request will be handled as if it was initiated by the client, and the response will be passed back to the client.

      This method mostly follows the semantics of JavaEE javax.servlet.http.PushBuilder. This means most of the headers of this request are copied into the push request, and the referer is set. To override this behavior, add a corresponding header to the request passed as the parameter of this method: those headers take precedence.

      Security note: The Authorization header and other headers not excluded by the above paragraph will be copied and sent to the client as part of a HTTP2 PUSH_PROMISE. Normally, this is fine, because the client sent those headers in the first place. But if there is an intermediate proxy that added a header, this header may then leak to the client.

      request - The request to respond to using a server push.
      This request.
      UnsupportedOperationException - if the client does not support server push. Check beforehand using isServerPushSupported().