public class PushHeaderItem extends HeaderItem
Modifier and Type | Field and Description |
---|---|
static String |
HTTP2_PROTOCOL
The http2 protocol string
|
Constructor and Description |
---|
PushHeaderItem(Page page,
Request pageRequest,
Response pageResponse)
Creates a push header item based on the given page and the corresponding page request / page
response.
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyPageCacheHeader()
Applies the cache header item to the response
|
javax.servlet.http.HttpServletRequest |
checkHttpServletRequest(Request request)
Checks if the container request from the given request is instance of
HttpServletRequest if not the API of the PushHeaderItem can't be used and a
WicketRuntimeException is thrown. |
boolean |
equals(Object o) |
javax.servlet.http.HttpServletRequest |
getContainerRequest(Request request)
Gets the container request
|
protected Time |
getPageModificationTime()
Gets the time the page of this header item has been modified.
|
Iterable<?> |
getRenderTokens()
Uses the URLs that has already been pushed to the client to ensure not to push them again
|
int |
hashCode() |
boolean |
isHttp2(javax.servlet.http.HttpServletRequest request)
Checks if the given request is a http/2 request
|
protected void |
push(javax.servlet.http.HttpServletRequest request)
Pushed all URLs of this header item to the client
|
PushHeaderItem |
push(List<PushItem> pushItems)
Creates a URL and pushes the resource to the client - this is only supported if http2 is
enabled
|
void |
render(Response response)
Pushes the previously created URLs to the client
|
getDependencies, getProvidedResources
public static final String HTTP2_PROTOCOL
public PushHeaderItem(Page page, Request pageRequest, Response pageResponse)
page
- the page this header item is applied topageRequest
- the page request this header item is applied topageResponse
- the page response this header item is applied topublic Iterable<?> getRenderTokens()
getRenderTokens
in class HeaderItem
HeaderItem
can be identified by. If any of the tokens has
already been rendered, this HeaderItem
will not be rendered.protected Time getPageModificationTime()
protected Time getPageModificationTime(){
Time time = getPageModificationTime();
// read properties file with build time and place it into a second time variable
return time.before(buildTime) ? buildTime : time;
}
protected void applyPageCacheHeader()
public void render(Response response)
render
in class HeaderItem
protected void push(javax.servlet.http.HttpServletRequest request)
request
- the request to push the URLs topublic PushHeaderItem push(List<PushItem> pushItems)
pushItems
- a list of items to be pushed to the clientpublic javax.servlet.http.HttpServletRequest getContainerRequest(Request request)
request
- the wicket request to get the container request frompublic boolean isHttp2(javax.servlet.http.HttpServletRequest request)
request
- the request to check if it is a http/2 requestpublic javax.servlet.http.HttpServletRequest checkHttpServletRequest(Request request)
HttpServletRequest
if not the API of the PushHeaderItem can't be used and a
WicketRuntimeException
is thrown.request
- the request to get the container request from. The container request is checked if
it is instance of HttpServletRequest
HttpServletRequest
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.