dbeaver/pro#9733 Rename X- headers to CB- with backward compatibility (#4517)

This commit is contained in:
Viktor Kirst
2026-08-11 19:16:38 +03:00
committed by GitHub
parent 5fb7234e24
commit 317750ea7d
2 changed files with 10 additions and 1 deletions
@@ -235,6 +235,14 @@ public class ServletAppUtils {
response.addCookie(sessionCookie);
}
public static String getHeaderOrLegacy(HttpServletRequest request, String headerName, String legacyHeaderName) {
String value = request.getHeader(headerName);
if (CommonUtils.isEmpty(value)) {
value = request.getHeader(legacyHeaderName);
}
return value;
}
public static String getRequestCookie(HttpServletRequest request, String cookieName) {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
@@ -215,6 +215,7 @@ public class CBEventsLongPollingServlet extends HttpServlet {
ps.handleWebSessionEvent(new WSSocketConnectedEvent(ws.getApplication().getApplicationRunId()));
resp.setHeader(WSConstants.WS_SESSION_HEADER, sid);
resp.setHeader(WSConstants.WS_SESSION_HEADER_LEGACY, sid);
log.debug("HTTP Long-Poll channel opened for session " + sid);
return ps;
@@ -304,7 +305,7 @@ public class CBEventsLongPollingServlet extends HttpServlet {
@Override
public BaseWebSession resolve(@NotNull HttpServletRequest req) throws SMException {
String sid = req.getHeader(WSConstants.WS_SESSION_HEADER);
String sid = ServletAppUtils.getHeaderOrLegacy(req, WSConstants.WS_SESSION_HEADER, WSConstants.WS_SESSION_HEADER_LEGACY);
String token = req.getHeader(WSConstants.WS_AUTH_HEADER);
if (CommonUtils.isEmpty(sid) && CommonUtils.isEmpty(token)) {