use of io.undertow.util.HeaderValues in project undertow by undertow-io.
the class PushBuilderImpl method push.
@Override
public void push() {
if (path == null) {
throw UndertowServletMessages.MESSAGES.pathWasNotSet();
}
ServerConnection con = servletRequest.getExchange().getConnection();
if (con.isPushSupported()) {
HeaderMap newHeaders = new HeaderMap();
for (HeaderValues entry : headers) {
newHeaders.addAll(entry.getHeaderName(), entry);
}
if (conditional) {
if (etag != null) {
newHeaders.put(Headers.IF_NONE_MATCH, etag);
} else if (lastModified != null) {
newHeaders.put(Headers.IF_MODIFIED_SINCE, lastModified);
}
}
if (sessionId != null) {
//TODO: do this properly, may be a different tracking method or a different cookie name
newHeaders.put(Headers.COOKIE, "JSESSIONID=" + sessionId);
}
String path = this.path;
if (queryString != null && !queryString.isEmpty()) {
path += "?" + queryString;
}
con.pushResource(path, new HttpString(method), newHeaders);
}
path = null;
etag = null;
lastModified = null;
}
Aggregations