use of org.webpieces.ctx.api.RouterCookie in project webpieces by deanhiller.
the class ResponseCreator method addCommonHeaders.
public void addCommonHeaders(Http2Request request, Http2Response response, boolean isInternalError, boolean isDynamicPartOfWebsite) {
String connHeader = request.getSingleHeaderValue(Http2HeaderName.CONNECTION);
DateTime now = DateTime.now().toDateTime(DateTimeZone.UTC);
String dateStr = formatter.print(now) + " GMT";
//in general, nearly all these headers are desired..
Http2Header date = new Http2Header(Http2HeaderName.DATE, dateStr);
response.addHeader(date);
if (isDynamicPartOfWebsite) {
List<RouterCookie> cookies = createCookies(isInternalError);
for (RouterCookie c : cookies) {
Http2Header cookieHeader = create(c);
response.addHeader(cookieHeader);
}
}
if (connHeader == null)
return;
else if (!"keep-alive".equals(connHeader))
return;
//just re-use the connHeader from the request...
response.addHeader(request.getHeaderLookupStruct().getHeader(Http2HeaderName.CONNECTION));
}
use of org.webpieces.ctx.api.RouterCookie in project webpieces by deanhiller.
the class RouterServiceImpl method copy.
private Map<String, RouterCookie> copy(Map<String, String> cookies) {
Map<String, RouterCookie> map = new HashMap<>();
for (Entry<String, String> entry : cookies.entrySet()) {
RouterCookie c = copy(entry.getKey(), entry.getValue());
map.put(c.name, c);
}
return map;
}
use of org.webpieces.ctx.api.RouterCookie in project webpieces by deanhiller.
the class CookieTranslator method createBase.
private RouterCookie createBase(String name, Integer maxAge) {
RouterCookie cookie = new RouterCookie();
cookie.name = name;
cookie.domain = null;
cookie.path = "/";
cookie.maxAgeSeconds = maxAge;
cookie.isHttpOnly = isCookiesHttpOnly;
cookie.isSecure = isCookiesSecure;
cookie.value = "";
return cookie;
}
use of org.webpieces.ctx.api.RouterCookie in project webpieces by deanhiller.
the class RequestStreamWriter method copy.
private Map<String, RouterCookie> copy(Map<String, String> cookies) {
Map<String, RouterCookie> map = new HashMap<>();
for (Entry<String, String> entry : cookies.entrySet()) {
RouterCookie c = copy(entry.getKey(), entry.getValue());
map.put(c.name, c);
}
return map;
}
use of org.webpieces.ctx.api.RouterCookie in project webpieces by deanhiller.
the class ResponseCreator method addDeleteCookie.
public void addDeleteCookie(Http2Response response, String badCookieName) {
RouterCookie cookie = cookieTranslator.createDeleteCookie(badCookieName);
Http2Header cookieHeader = create(cookie);
response.addHeader(cookieHeader);
}
Aggregations