- Type Parameters:
B- The Http message body
- All Known Implementing Classes:
HttpRequestthat is potentially capable of HTTP2 server push. Code should check
isServerPushSupported()before attempting to send any server push.
- Jonas Konrad
Methods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getHeaders
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getCookies, getHttpVersion, getLocale, getMethod, getMethodName, getOrigin, getParameters, getPath, getRemoteAddress, getServerAddress, getServerName, getUri, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute
isServerPushSupportedboolean 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
trueiff server push is supported.
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
requestpassed as the parameter of this method: those headers take precedence.
Security note: The
Authorizationheader 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.