if (nodeIdStr.length()==1) {
nodeIdStr = "0"+nodeIdStr;
}
Cookie[] cookies = ureq.getHttpReq().getCookies();
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if ("JSESSIONID".equals(cookie.getName())) {
String redirectedButInvalidSessionId = cookie.getValue();
redirectedButInvalidSessionId = redirectedButInvalidSessionId.substring(0, redirectedButInvalidSessionId.length()-2) + nodeIdStr;
Tracing.logInfo("redirecting session to node "+nodeIdStr+", new sessionid="+redirectedButInvalidSessionId, getClass());
cookie.setValue(redirectedButInvalidSessionId);
replaceCookie(ureq.getHttpReq(), ureq.getHttpResp(), cookie);
// OLAT-5165: make sure we can always bypass the dmz reject mechanism (for 5min that is)
Cookie newCookie = new Cookie("bypassdmzreject", String.valueOf(System.currentTimeMillis()));
newCookie.setMaxAge(5 * 60); // 5min lifetime
newCookie.setPath(WebappHelper.getServletContextPath());
newCookie.setSecure(ureq.getHttpReq().isSecure());
newCookie.setComment("cookie allowing olat admin users to bypass dmz rejects");
ureq.getHttpResp().addCookie(newCookie);
OncePanel oncePanel = new OncePanel("refresh");
oncePanel.setContent(createVelocityContainer("refresh"));
mainVc.put("refresh", oncePanel);