Example usage for javax.servlet.http HttpSession removeAttribute

List of usage examples for javax.servlet.http HttpSession removeAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession removeAttribute.

Prototype

public void removeAttribute(String name);

Source Link

Document

Removes the object bound with the specified name from this session.

Usage

From source file:com.enonic.vertical.adminweb.UserHandlerServlet.java

private void addPhotoFromSession(HttpSession session, UserInfo userInfo) {
    UserPhotoHolder userPhoto = (UserPhotoHolder) session.getAttribute(SESSION_PHOTO_ITEM_KEY);

    if (userPhoto != null) {
        userInfo.setPhoto(userPhoto.getPhoto());
        session.removeAttribute(SESSION_PHOTO_ITEM_KEY);
    }/* w  ww  .  j av  a2 s. c om*/
}

From source file:com.inverse2.ajaxtoaster.AjaxToasterServlet.java

public void logout(ServiceOperationInterface service) {
    HttpServletRequest request;// w ww .j  av  a  2s .  co  m
    HttpSession session;

    request = service.getSessionRequest();
    session = request.getSession(true);

    session.setAttribute(ATTRIB_LOGGED_IN, "false");
    session.removeAttribute(ATTRIB_LOGGED_IN_USER);
}

From source file:io.apicurio.studio.fe.servlet.filters.GitHubAuthenticationFilter.java

/**
 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
 *      javax.servlet.ServletResponse, javax.servlet.FilterChain)
 *///  www .  ja v a 2  s.  c o m
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    HttpServletRequest httpReq = (HttpServletRequest) request;
    HttpServletResponse httpResp = (HttpServletResponse) response;
    HttpSession session = httpReq.getSession();

    if (httpReq.getServletPath().endsWith("/callback")) {
        String code = httpReq.getParameter("code");
        String state = (String) session.getAttribute(STATE_KEY);

        AccessTokenRequest tokenReq = new AccessTokenRequest();
        tokenReq.setClient_id(clientId);
        tokenReq.setClient_secret(clientSecret);
        tokenReq.setCode(code);
        tokenReq.setState(state);

        try {
            HttpResponse<AccessTokenResponse> tokenResp = Unirest.post(ACCESS_TOKEN_URL)
                    .header("Content-Type", "application/json").header("Accept", "application/json")
                    .body(tokenReq).asObject(AccessTokenResponse.class);

            AccessTokenResponse token = tokenResp.getBody();
            session.setAttribute(RequestAttributeKeys.AUTH_KEY, token);
            User user = authenticateUser(token.getAccess_token());
            session.setAttribute(RequestAttributeKeys.USER_KEY, user);

            String redirectUrl = (String) session.getAttribute(REDIRECT_KEY);
            httpResp.sendRedirect(redirectUrl);
        } catch (UnirestException e) {
            throw new ServletException(e);
        }
    } else if (httpReq.getServletPath().endsWith("/logout")) {
        session.removeAttribute(RequestAttributeKeys.AUTH_KEY);
        session.removeAttribute(RequestAttributeKeys.USER_KEY);

        String logoutPageHtml = createLogoutPage();
        httpResp.setContentType("text/html");
        httpResp.setContentLength(logoutPageHtml.length());
        httpResp.getWriter().print(logoutPageHtml);
        httpResp.getWriter().flush();
    } else {
        AccessTokenResponse token = (AccessTokenResponse) session.getAttribute(RequestAttributeKeys.AUTH_KEY);
        if (token == null) {
            StringBuffer originalAppUrl = httpReq.getRequestURL();
            String qs = httpReq.getQueryString();
            if (qs != null && !qs.isEmpty()) {
                originalAppUrl.append("?").append(qs);
            }
            session.setAttribute(REDIRECT_KEY, originalAppUrl.toString());
            String state = String.valueOf(random.nextInt());
            session.setAttribute(STATE_KEY, state);
            String authUrl = AUTH_URL + clientId + "&state=" + state;

            String loginPageHtml = createLoginPage(authUrl);
            httpResp.setContentType("text/html");
            httpResp.setContentLength(loginPageHtml.length());
            httpResp.getWriter().print(loginPageHtml);
            httpResp.getWriter().flush();
        } else {
            chain.doFilter(request, response);
        }
    }
}

From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractHomeController.java

@RequestMapping(value = { "/home" })
public String home(@ModelAttribute("currentTenant") Tenant tenant,
        @RequestParam(value = "tenant", required = false) String tenantParam,
        @RequestParam(value = "secondLevel", required = false) boolean secondLevel, ModelMap map,
        HttpSession session, HttpServletRequest request) throws ConnectorManagementServiceException {
    logger.debug("###Entering in home(map) method");

    map.addAttribute("maintenance", healthService.listPlannedNotifications(null));
    map.addAttribute("showWarningOfServiceInstanceNotEnabled", true);

    User user = getCurrentUser();//from  w w  w .ja va  2  s . co m

    // setting login success message only when request come from login page.
    if (session.getAttribute("loginreturn") != null && session.getAttribute("loginreturn").equals("success")) {
        map.addAttribute("return_message", "true");
        map.addAttribute("return_message_type", "info");
        session.removeAttribute("loginreturn");
    }

    if (!(config.getBooleanValue(Configuration.Names.com_citrix_cpbm_portal_directory_service_enabled))) {
        if (user.getPassword() == null) {
            map.clear();
            return "redirect:/portal/users/" + user.getParam() + "/myprofile";
        }
    }

    if ((user.getFirstName() == null || user.getFirstName().isEmpty())
            || (user.getLastName() == null || user.getLastName().isEmpty())) {
        map.clear();
        return "redirect:/portal/users/" + user.getParam() + "/myprofile";
    }

    List<String> currentUserServiceCategoryList = userService.getAllAccessibleCloudServiceCategories(user);

    tenant = (Tenant) request.getAttribute(UserContextInterceptor.EFFECTIVE_TENANT_KEY);

    if ((userService.hasAnyAuthority(user, "ROLE_ACCOUNT_CRUD", "ROLE_ACCOUNT_MGMT", "ROLE_FINANCE_CRUD"))
            && (Boolean) request.getAttribute("isSurrogatedTenant")) {
        user = tenant.getOwner();
        map.addAttribute("showUserProfile", true);
        setPage(map, Page.CRM_HOME);
    } else {
        setPage(map, Page.HOME);
    }
    fetchEvents(user, map);
    map.addAttribute("userHasCloudServiceAccount", userService.isUserHasAnyActiveCloudService(user));
    if (!userService.hasAuthority(user, "ROLE_TICKET_MANAGEMENT")
            && !tenant.getAccountId().equals(TenantService.SYSTEM_TENANT)) {
        if (user.equals(user.getTenant().getOwner())
                || userService.hasAuthority(user, "ROLE_ACCOUNT_BILLING_ADMIN")
                || userService.hasAuthority(user, "ROLE_ACCOUNT_ADMIN")) {
            try {

                AccountStatement provisionalAccountStatement = billingService
                        .getOrCreateProvisionalAccountStatement(tenant);
                HashMap<String, Object> spendVsBudgetChartData = reportService.getChartData(user, "tenant",
                        getSessionLocale(request), provisionalAccountStatement);
                map.addAttribute("chartData", JSONUtils.toJSONString(spendVsBudgetChartData));
                map.addAttribute("spend_vs_budget_chart_data_obj", spendVsBudgetChartData);

                addToChartData(map, provisionalAccountStatement);

            } catch (Exception e) {
                logger.error("Caught Exception while getting chart data", e);
                map.addAttribute("chartData", null);
            }
        } else {
            try {
                map.addAttribute("chartData", JSONUtils
                        .toJSONString(reportService.getChartData(user, "user", getSessionLocale(request))));
            } catch (Exception e) {
                logger.error("Caught Exception while getting chart data", e);
                map.addAttribute("chartData", null);
            }
        }
    }

    // Showing only four tasks on the dashboard
    Map<Task, String> taskUrlMap = taskService.getPendingTasksMap(tenant, user, 1, 4);
    map.addAttribute("taskUrlMap", taskUrlMap);

    map.addAttribute("tickets", null);
    map.addAttribute("totalTickets", 0);
    List<User> usersUnderTenant = userService.list(0, 0, null, null, false, null, tenant.getId().toString(),
            null);

    map.addAttribute("users", usersUnderTenant);

    map.addAttribute("isOwner", getCurrentUser().equals(tenant.getOwner()));
    map.addAttribute("user", user);
    // check user limit
    int userLimit;
    if (tenant.getMaxUsers() != null) {
        userLimit = tenant.getMaxUsers().intValue();
    } else {
        userLimit = tenant.getAccountType().getMaxUsers().intValue();
    }
    int noOfUsers = usersUnderTenant.size();
    if (userLimit >= 0 && noOfUsers >= userLimit) {
        map.addAttribute("isUsersMaxReached", "Y");
    }
    map.addAttribute("currentDate", new Date());
    map.addAttribute("tenant", tenant);

    List<ServiceInstance> ticketTypeServiceInstance = userService.getServiceInstance(user, "OSS", "TICKET");
    BaseConnector ticketTypeConnector = connectorManagementService
            .getOssServiceInstancebycategory(ConnectorType.TICKET);
    if (!ticketTypeServiceInstance.isEmpty()
            || (ticketTypeConnector != null && user.isEnabled() && !user.isLocked())) {
        map.addAttribute("ticketServiceInstance", true);
    } else {
        map.addAttribute("ticketServiceInstance", false);
    }
    // Fetching category list and prepending it with All category
    List<String> serviceCategoryList = userService.getAllAccessibleCloudServiceCategories(user);
    serviceCategoryList.retainAll(currentUserServiceCategoryList);
    serviceCategoryList.add(0, CssdkConstants.ALL);
    map.addAttribute("serviceCategoryList", serviceCategoryList);

    // populate custom fields
    customFieldService.populateCustomFields(user);
    customFieldService.populateCustomFields(user.getTenant());

    // Intances added for service health
    List<ServiceInstance> cloudTypeServiceInstances = userService.getCloudServiceInstance(user, null);
    map.addAttribute("cloudTypeServiceInstances", cloudTypeServiceInstances);

    String view = null;
    if (tenant.equals(tenantService.getSystemTenant())) {
        HashMap<String, Object> parameters = new HashMap<String, Object>();
        Calendar start = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
        start.add(Calendar.DATE, -7);
        parameters.put("startDate", format.format(start.getTime()));
        parameters.put("endDate", format.format(end.getTime()));
        List<AccountType> accountTypeList = tenantService.getAllAccountTypes();
        accountTypeList.remove(tenantService.getAccountTypeByName("SYSTEM"));
        GenericReport nrr = new NewRegistrationReport(parameters, dataSource, accountTypeList,
                getSessionLocale(request), messageSource);

        Report reportFusionNR = null;
        reportFusionNR = reportService.generateFusionReport(nrr);
        reportFusionNR.getAttributes().put("chartId", "HomeNewReg");
        reportFusionNR.getAttributes().put("fusionChartType", "MSColumn2D");
        map.addAttribute("reportFusionNR", reportFusionNR);

        HashMap<String, Object> parametersCR = new HashMap<String, Object>();
        parametersCR.put("month", Calendar.getInstance().get(Calendar.MONTH) + 1);
        parametersCR.put("year", Calendar.getInstance().get(Calendar.YEAR));
        parametersCR.put("defaultCurrency",
                messageSource.getMessage(
                        "currency.symbol."
                                + config.getValue(Names.com_citrix_cpbm_portal_settings_default_currency),
                        null, getSessionLocale(request)));
        GenericReport crr = new CustomerRankReport(parametersCR, dataSource, config, getSessionLocale(request),
                messageSource);

        Report reportFusionCR = null;
        reportFusionCR = reportService.generateFusionReport(crr);
        reportFusionCR.getAttributes().put("chartId", "HomeCustRank");
        reportFusionCR.getAttributes().put("fusionChartType", "Column2D");
        map.addAttribute("reportFusionCR", reportFusionCR);
        map.addAttribute("showCloudConsoleLink", true);
        view = "main.home_service_with_second_level";
    } else {
        AccountStatement accountStatement = billingAdminService.getOrCreateProvisionalAccountStatement(tenant);
        map.addAttribute("currentBillingStart", accountStatement.getBillingPeriodStartDate());
        Date nextInvoiceDate = DateUtils.addOneDay(accountStatement.getBillingPeriodEndDate());
        map.addAttribute("nextInvoiceDate", nextInvoiceDate);
        view = "main.home_with_second_level";
    }
    logger.debug("###Exiting home(map) method");

    return view;
}

From source file:com.poscoict.license.service.BoardService.java

public String changePassword(String oriPass, String newPass, HttpSession session) throws Exception {
    StandardPasswordEncoder encoder = new StandardPasswordEncoder();
    PrivateKey privateKey = (PrivateKey) session.getAttribute("__rsaPrivateKey__");

    CustomUserDetails userDetails = (CustomUserDetails) session.getAttribute("userDetails");
    String userNo = userDetails.getUserNo();
    String userPassword = userDetails.getPassword();
    logger.info("changePassword: " + userNo);

    String result = "";

    if (encoder.matches(decryptRsa(privateKey, oriPass), userPassword)) {
        result = "success";

        String newPassword = encoder.encode(decryptRsa(privateKey, newPass));
        userDao.modifyPassword(userNo, newPassword);

        session.removeAttribute("__rsaPrivateKey__");
        session.removeAttribute("changePassword");
        userDetails.setPassword(newPassword);
        userDetails.setChangePassword(false);
        session.setAttribute("userDetails", userDetails);

        logger.info("changePassword-success " + userNo);
    } else {//  w w  w.j  a  va2s. co m
        result = "fail";
        logger.info("changePassword-fail " + userNo);
    }

    return result;
}

From source file:egpi.tes.ahv.servicio.MenuReporteJasper.java

/**
 * /*w  w w .j  a  v a2s  .c om*/
 * @param request
 * @param response
 * @throws ServletException
 * @throws IOException 
 */
public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    try {

        String separador = System.getProperty("file.separator");
        HttpSession session = request.getSession(true);
        client = new HttpClient();
        pathaplicacion = "pathpublico";
        properties = (Properties) session.getAttribute("propiedadesjasper");

        if (request.getParameter("inputcontrol") != null && request.getParameter("inputcontrol").equals("1")) {
            System.out.println("VERIFICANDO LOS PARAMETROS DE PROCESO" + client);
            AutenticacionVO autenticacionVO = null;
            if (session.getAttribute("authVO") == null) {
                autenticacionVO = new AutenticacionVO();
                autenticacionVO.setUsername(this.properties.getProperty("usuariopublico"));
                autenticacionVO.setPassword(this.properties.getProperty("password"));
            } else {
                autenticacionVO = (AutenticacionVO) session.getAttribute("authVO");
            }

            if (validarUsuario(autenticacionVO)) {
                System.out.println("USUARIO VALIDADO CORRECTAMENTE....");
                procesarControlesEntrada(request.getParameter("parentFolder"));
            }

        } else {
            sincronizarMenu.setPath(request.getRealPath("") + separador
                    + properties.getProperty("pathinstalacion") + separador + "menu" + separador + "cache");
            if (request.getParameter("cerrar") != null && request.getParameter("cerrar").equals("1")) {
                session.removeAttribute("authVO");
                autenticacionVO = null;
            }
            obtenerDescriptorGeneral();
            session.setAttribute("menuDeplegable", sincronizarMenu.menuDesplegable());
        }

        PrintWriter out = response.getWriter();
        out.println(obj);

    } catch (Exception e) {
        e.printStackTrace();
        procesarError(response, e);
    }

}

From source file:com.tecapro.inventory.common.action.BaseAction.java

/**
 * Check action with session/*  ww  w .j  av a 2 s  .com*/
 *
 * @param form
 * @param request
 * @param mapping
 */
private void changeSession(BaseForm form, HttpServletRequest request, ActionMapping mapping) {
    String param = mapping.getParameter();

    if (param != null && param.contains(PARAM_CREATE_SESSION)) {
        // new HTTPSession
        HttpSession session = request.getSession(true);
        session.setAttribute(Constants.SESSION_INFO, form.getValue().getInfo().getMainSessInfo());
        userInfo = new UserInfoValue();

    } else if (param != null
            && (param.contains(PARAM_INVALIDATE_SESSION) || param.contains(PARAM_NO_SESSION))) {
        HttpSession session = request.getSession(false);
        if (session != null) {
            session.removeAttribute(Constants.SESSION_INFO);
            session.invalidate();
        }
        userInfo = new UserInfoValue();
    } else {
        HttpSession session = request.getSession(false);
        if (session != null) {
            session.setAttribute(Constants.SESSION_INFO, form.getValue().getInfo().getMainSessInfo());
        }
    }

}

From source file:com.tremolosecurity.proxy.ConfigSys.java

public void doConfig(HttpServletRequest req, HttpServletResponse resp, NextSys nextSys)
        throws IOException, ServletException {
    UrlHolder holder = null;//  w  w w.  j a va 2s .com
    AuthInfo userAuth = null;
    try {

        SessionManager sessionManager = (SessionManager) this.ctx
                .getAttribute(ProxyConstants.TREMOLO_SESSION_MANAGER);

        boolean setSessionCookie = false;
        boolean checkLogout = false;

        RequestHolder reqHolder = (RequestHolder) req.getAttribute(ProxyConstants.TREMOLO_REQ_HOLDER);
        holder = (UrlHolder) req.getAttribute(ProxyConstants.AUTOIDM_CFG);
        boolean isForcedAuth = req.getAttribute(ProxyConstants.TREMOLO_IS_FORCED_AUTH) != null
                ? (Boolean) req.getAttribute(ProxyConstants.TREMOLO_IS_FORCED_AUTH)
                : false;

        checkLogout = true;

        StringBuffer resetsb = new StringBuffer(cfg.getAuthPath()).append("resetChain");

        HttpSession sharedSession = req.getSession();

        if (sharedSession != null) {
            AuthController actl = (AuthController) sharedSession.getAttribute(ProxyConstants.AUTH_CTL);

            if (actl != null && actl.getHolder() != null) {

                RequestHolder presentHolder = actl.getHolder();
                AuthInfo authdata = actl.getAuthInfo();
                userAuth = authdata;
                if (!req.getRequestURI().startsWith(cfg.getAuthPath())
                        /*&&  ! presentHolder.getUrlNoQueryString().equalsIgnoreCase(req.getRequestURL().toString())*/ && (authdata == null
                                || !authdata.isAuthComplete())) {
                    //we're going to ignore requests for favicon.ico
                    if (!req.getRequestURI().endsWith("/favicon.ico")
                            && !req.getRequestURI().endsWith("/apple-touch-icon-precomposed.png")
                            && !req.getRequestURI().endsWith("/apple-touch-icon.png")) {
                        sharedSession.removeAttribute(ProxyConstants.AUTH_CTL);
                        this.cfg.createAnonUser(sharedSession);
                    }

                } else if (req.getRequestURI().equalsIgnoreCase(resetsb.toString())) {
                    sharedSession.removeAttribute("TREMOLO_AUTH_URI");
                    for (AuthStep step : actl.getAuthSteps()) {
                        step.setExecuted(false);
                        step.setSuccess(false);
                    }

                    actl.setCurrentStep(actl.getAuthSteps().get(0));

                    String chainName = holder.getUrl().getAuthChain();
                    AuthChainType chain = cfg.getAuthChains().get(chainName);
                    String mech = chain.getAuthMech().get(0).getName();
                    String uri = cfg.getAuthMechs().get(mech).getUri();

                    holder.getConfig().getAuthManager().loadAmtParams(sharedSession,
                            chain.getAuthMech().get(0));

                    String redirectURI = "";
                    if (holder.getConfig().getContextPath().equalsIgnoreCase("/")) {
                        redirectURI = uri;
                    } else {

                        redirectURI = new StringBuffer().append(holder.getConfig().getContextPath()).append(uri)
                                .toString();
                    }

                    sharedSession.setAttribute("TREMOLO_AUTH_URI", redirectURI);

                    resp.sendRedirect(redirectURI);
                    return;

                }
            }

            if (isForcedAuth) {

                actl.setHolder(reqHolder);

                String authChain = holder.getUrl().getAuthChain();
                AuthChainType act = cfg.getAuthChains().get(authChain);
                holder.getConfig().getAuthManager().loadAmtParams(sharedSession, act.getAuthMech().get(0));
            }
        }

        if (holder == null) {

            if (req.getRequestURI().startsWith(cfg.getAuthPath())) {

                req.setAttribute(ProxyConstants.AUTOIDM_MYVD, cfg.getMyVD());

                ProxyResponse presp = new ProxyResponse((HttpServletResponse) resp, (HttpServletRequest) req);

                //we still need a holder

                /*AuthController actl = (AuthController) sharedSession.getAttribute(AuthSys.AUTH_CTL);
                if (actl != null) {
                   holder = cfg.findURL(actl.getHolder().getUrlNoQueryString());
                   req.setAttribute(ConfigSys.AUTOIDM_CFG, holder);
                } else {*/
                AuthMechanism authMech = cfg.getAuthMech(((HttpServletRequest) req).getRequestURI());

                if (authMech != null) {
                    String finalURL = authMech.getFinalURL(req, resp);

                    if (finalURL != null) {

                        holder = cfg.findURL(finalURL);

                    } else {
                        //throw new ServletException("Can not generate holder");
                    }
                } else {
                    //throw new ServletException("Can not generate holder");
                }

                //no holder should be needed beyond this point

                //}

                /*
                        
                        
                String urlChain = holder.getUrl().getAuthChain();
                AuthChainType act = holder.getConfig().getAuthChains().get(urlChain);
                        
                HashMap<String,Attribute> params = new HashMap<String,Attribute>();
                ProxyUtil.loadParams(req, params);
                reqHolder = new RequestHolder(HTTPMethod.GET,params,finalURL,true,act.getName());
                        
                isForcedAuth = true;
                req.setAttribute(ConfigSys.AUTOIDM_CFG, holder);
                        
                String chainName = holder.getUrl().getAuthChain();
                AuthChainType chain = cfg.getAuthChains().get(chainName);
                String mech = chain.getAuthMech().get(0).getName();
                String uri = cfg.getAuthMechs().get(mech).getUri();
                        
                AuthSys.loadAmtParams(sharedSession, chain.getAuthMech().get(0));
                   }
                } 
                           
                        
                if (holder == null) {
                   resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
                   AccessLog.log(AccessEvent.NotFound, null, req, null, "Resource Not Found");
                   return;
                }*/

                nextSys.nextSys(req, presp);
                presp.pushHeadersAndCookies(null);
            } else {

                String redirectLocation = cfg.getErrorPages().get(HttpServletResponse.SC_NOT_FOUND);
                if (redirectLocation != null) {
                    resp.sendRedirect(redirectLocation);
                } else {
                    resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
                }

                AccessLog.log(AccessEvent.NotFound, null, req, null, "Resource Not Found");

            }

        } else {
            req.setAttribute(ProxyConstants.AUTOIDM_CFG, holder);
            req.setAttribute(ProxyConstants.AUTOIDM_MYVD, cfg.getMyVD());

            ProxyResponse presp = new ProxyResponse((HttpServletResponse) resp, (HttpServletRequest) req);

            ProxyData pd = null;

            try {
                nextSys.nextSys(req, presp);

                pd = (ProxyData) req.getAttribute(ProxyConstants.TREMOLO_PRXY_DATA);

                if (holder.getApp().getCookieConfig() != null) {
                    String logouturi = holder.getApp().getCookieConfig().getLogoutURI();

                    AuthController actl = (AuthController) sharedSession.getAttribute(ProxyConstants.AUTH_CTL);

                    if (actl != null) {

                        AuthInfo authdata = actl.getAuthInfo();
                        userAuth = authdata;
                        if ((req.getRequestURI().equalsIgnoreCase(logouturi) || (pd != null && pd.isLogout()))
                                && (authdata != null)) {

                            //Execute logout handlers
                            ArrayList<LogoutHandler> logoutHandlers = (ArrayList<LogoutHandler>) sharedSession
                                    .getAttribute(LogoutUtil.LOGOUT_HANDLERS);
                            if (logoutHandlers != null) {
                                for (LogoutHandler h : logoutHandlers) {
                                    h.handleLogout(req, presp);
                                }
                            }

                            sessionManager.clearSession(holder, sharedSession, (HttpServletRequest) req,
                                    (HttpServletResponse) resp);
                        }
                    }
                }

                presp.pushHeadersAndCookies(holder);

                if (pd != null && pd.getIns() != null) {

                    if (pd.getResponse() == null) {
                        this.procData(resp, holder, pd.isText(), pd.getIns());
                    } else {
                        this.procData(pd.getRequest(), pd.getResponse(), holder, pd.isText(), pd.getIns(),
                                pd.getPostProc());
                    }

                }

            } finally {
                if (pd != null && pd.getHttpRequestBase() != null) {
                    pd.getHttpRequestBase().releaseConnection();
                    if (!resp.isCommitted()) {
                        resp.getOutputStream().flush();
                        resp.getOutputStream().close();
                    }
                }
            }

        }
    } catch (Exception e) {
        ApplicationType appType = null;
        if (holder != null) {
            appType = holder.getApp();
        } else {
            appType = new ApplicationType();
            appType.setName("UNKNOWN");

        }

        AccessLog.log(AccessEvent.Error, appType, (HttpServletRequest) req, userAuth, "NONE");

        req.setAttribute("TREMOLO_ERROR_REQUEST_URL", req.getRequestURL().toString());
        req.setAttribute("TREMOLO_ERROR_EXCEPTION", e);
        logger.error("Could not process request", e);

        String redirectLocation = cfg.getErrorPages().get(500);

        if (redirectLocation != null) {
            resp.sendRedirect(redirectLocation);
        } else {
            StringBuffer b = new StringBuffer();
            b.append(cfg.getAuthFormsPath()).append("error.jsp");
            resp.setStatus(500);
            req.getRequestDispatcher(b.toString()).forward(req, resp);
        }

    }
}