use of org.glassfish.grizzly.http.util.Header in project Payara by payara.
the class ApplicationPushBuilder method push.
@Override
public void push() {
if (path == null) {
throw new IllegalStateException(rb.getString(LogFacade.NO_PUSH_PATH_EXCEPTION));
}
Http2Stream http2Stream = (Http2Stream) coyoteRequest.getAttribute(Http2Stream.HTTP2_STREAM_ATTRIBUTE);
if (http2Stream == null || !http2Stream.isPushEnabled()) {
return;
}
// modify pathLocal rather than path
String pathLocal = ((path.charAt(0) == '/') ? path : coyoteRequest.getContextPath() + '/' + path);
if (queryString != null) {
pathLocal += ((pathLocal.indexOf('?') != -1) ? '&' + queryString : '?' + queryString);
}
// Session ID (do this before setting the path since it may change it)
if (sessionId != null) {
if (addSessionPathParameter) {
pathLocal = pathLocal + ";" + sessionCookieName + "=" + sessionId;
}
if (addSessionCookie) {
cookies.add(new Cookie(sessionCookieName, sessionId));
}
}
PushEvent.PushEventBuilder pushEventBuilder = PushEvent.builder();
pushEventBuilder.method(method);
pushEventBuilder.headers(headers);
pushEventBuilder.path(pathLocal);
pushEventBuilder.httpRequest(coyoteRequest.getRequest());
coyoteRequest.getContext().notifyDownstream(pushEventBuilder.build());
// Reset for next call
path = null;
for (Header conditionalHeader : CONDITIONAL_HEADERS) {
headers.removeHeader(conditionalHeader);
}
}
Aggregations