Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean exceptionOccurred = false; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { LoginUserParameters params = null; String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { String engineSessionId = UUID.randomUUID().toString(); params = new LoginUserParameters(profileName, authRecord); params.setSessionId(engineSessionId); params.setActionType(loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser); InitialContext context = new InitialContext(); try { VdcReturnValueBase returnValue = FiltersHelper.getBackend(context).login(params); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); req.setAttribute(FiltersHelper.Constants.REQUEST_USER_KEY, returnValue.getActionReturnValue()); VdcQueryReturnValue result = FiltersHelper.getBackend(context) .runPublicQuery(VdcQueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigurationValues.ApplicationMode, ConfigCommon.defaultConfigurationVersion)); if (result.getSucceeded()) { SetDataOnSessionParameters setDataParams = new SetDataOnSessionParameters( FiltersHelper.Constants.SESSION_APPLICATION_MODE_KEY, ApplicationMode.from((Integer) result.getReturnValue() )); setDataParams.setSessionId(engineSessionId); FiltersHelper.getBackend(context).runAction(VdcActionType.SetDataOnSession, setDataParams); } } } finally { context.close(); } } } } catch (Exception ex) { exceptionOccurred = true; log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (!exceptionOccurred) { chain.doFilter(request, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = true; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { LoginUserParameters params = null; String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { String engineSessionId = UUID.randomUUID().toString(); params = new LoginUserParameters(profileName, authRecord, engineSessionId); params.setActionType(loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser); InitialContext context = new InitialContext(); try { VdcReturnValueBase returnValue = FiltersHelper.getBackend(context).login(params); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); req.setAttribute(FiltersHelper.Constants.REQUEST_USER_KEY, returnValue.getActionReturnValue()); } } finally { context.close(); } } } } catch (Exception ex) { doFilter = false; log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }