private static void prepareUISession(ServiceContext context) { HttpServletRequest request = context.getRequest(); HttpSession httpSession = request.getSession(true); String connectionId = request.getParameter(CONNECTION_ID); if (connectionId != null) { context.setUISession(UISessionImpl.getInstanceFromSession(httpSession, connectionId)); } else if (isUIRequest(request)) { context.setUISession(new UISessionBuilder(context).buildUISession()); } }
private void handleValidRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServiceContext context = new ServiceContext(request, response, applicationContext); context.setServiceStore(new ServiceStore()); ContextProvider.setContext(context); try { prepareUISession(context); if (isUIRequest(request) || isServiceHandlerRequest(request)) { getServiceHandler().service(request, response); } else { sendStartupContent(request, response); } } finally { ContextProvider.disposeContext(); } }