} else {
values.addAll(Utils.parseHeaderValue(httpServletRequest.getHeader(name).trim()));
}
}
final TyrusUpgradeResponse tyrusUpgradeResponse = new TyrusUpgradeResponse();
final WebSocketEngine.UpgradeInfo upgradeInfo = engine.upgrade(requestContext, tyrusUpgradeResponse);
switch (upgradeInfo.getStatus()) {
case HANDSHAKE_FAILED:
httpServletResponse.sendError(tyrusUpgradeResponse.getStatus());
break;
case NOT_APPLICABLE:
filterChain.doFilter(request, response);
break;
case SUCCESS:
LOGGER.fine("Upgrading Servlet request");
handler.setHandler(httpServletRequest.upgrade(TyrusHttpUpgradeHandler.class));
final String frameBufferSize = request.getServletContext().getInitParameter(TyrusHttpUpgradeHandler.FRAME_BUFFER_SIZE);
if (frameBufferSize != null) {
handler.setIncomingBufferSize(Integer.parseInt(frameBufferSize));
}
handler.preInit(upgradeInfo, webSocketConnection, httpServletRequest.getUserPrincipal() != null);
if (requestContext.getHttpSession() != null) {
sessionToHandler.put((HttpSession) requestContext.getHttpSession(), handler);
}
httpServletResponse.setStatus(tyrusUpgradeResponse.getStatus());
for (Map.Entry<String, List<String>> entry : tyrusUpgradeResponse.getHeaders().entrySet()) {
httpServletResponse.addHeader(entry.getKey(), Utils.getHeaderFromList(entry.getValue()));
}
response.flushBuffer();
LOGGER.fine("Handshake Complete");