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:kr.co.exsoft.common.controller.SessionController.java

/***
 * /*  w  w  w.j  a  va2 s. c o  m*/
 * <pre>
 * 1.  :  
 * 2.  :
 * </pre>
 * @Method Name : logout
 * @param sessionVO
 * @param sessionStatus
 * @param request
 * @return String
 */
@RequestMapping("/logout.do")
public String logout(@ModelAttribute SessionVO sessionVO, SessionStatus sessionStatus,
        HttpServletRequest request) {

    // session listener 
    HttpSession session = request.getSession();
    session.setAttribute("externalCheck", "F");//valueunbound   flag
    session.removeAttribute("listener");
    sessionStatus.setComplete();

    HashMap<String, Object> param = new HashMap<String, Object>();

    try {

        param.put("cert_yn", Constant.NOTHING);
        param.put("login_type", Constant.NORMAL_LOGIN_TYPE);
        param.put("connect_type", Constant.CONNECT_TYPE_LOGOUT);

        sessionService.sessionOut(session, sessionVO, request, param);

    } catch (Exception e) {
        logger.error(e.getMessage());
    }

    ///return "layout/loginForm";
    return "redirect:/login.do";
}

From source file:com.toft.widgets.login.LoginAction.java

/**
 * session??/*from   w w  w  .j a va  2 s.c o  m*/
 * 
 * @return boolean
 * @throws Exception
 */
private boolean checkVerCode() throws Exception {
    HttpSession session = this.getRequest().getSession(true);
    String verCode2 = null;

    if (session.getAttribute(ToftConst.VERIFYED_CODE) != null) {
        verCode2 = (String) session.getAttribute(ToftConst.VERIFYED_CODE);
    } else {
        return true;
    }

    // Session???
    session.removeAttribute(ToftConst.VERIFYED_CODE);
    String verCode = (String) getContext().getParam("verCode");
    return verCode != null && verCode.equals(verCode2);// ?
}

From source file:gov.nih.nci.cabig.caaers.web.ae.CaptureAdverseEventController.java

@Override
protected ModelAndView processFinish(HttpServletRequest request, HttpServletResponse response, Object oCommand,
        BindException errors) throws Exception {

    HttpSession session = request.getSession();
    session.removeAttribute("reviewResult");

    CaptureAdverseEventInputCommand command = (CaptureAdverseEventInputCommand) oCommand;

    //populate the base date, associated to each report definition.
    command.getReviewResult()//w  ww .j  a v a  2 s  . c  om
            .setBaseDateMap(command.findBaseDateMap(command.getReviewResult().getAeReportId()));

    //populate the report-IDs (for withdraw & amend)
    command.populateReportsToAmend();
    command.populateReportsToWithdraw();

    //populate the reports to un-amend
    command.populateReportsToUnAmend();

    command.save(false);

    //create the model to return
    ModelAndView modelAndView = null;

    Map<String, Object> model = new ModelMap("participant", command.getParticipant().getId());
    model.put("study", command.getStudy().getId());

    //check if this is alone a withdraw ?
    if (command.getReviewResult().isOnlyActionWithdraw()) {
        ExpeditedAdverseEventReport aeReport = command.getAdverseEventReportingPeriod()
                .findExpeditedAdverseEventReport(command.getReviewResult().getAeReportId());
        if (aeReport != null) {
            expeditedAdverseEventReportDao.lock(aeReport);
            if (CollectionUtils.isNotEmpty(command.getReviewResult().getUnwantedAEList())) {

                //remove all the deselected aes. 
                for (Integer aeId : command.getReviewResult().getUnwantedAEList()) {
                    AdverseEvent ae = aeReport.findAdverseEventById(aeId);
                    if (ae == null)
                        continue;
                    aeReport.getAdverseEvents().remove(ae);
                    ae.clearAttributions();
                    ae.setReport(null);
                }

                expeditedAdverseEventReportDao.save(aeReport);
            }

            //process the reports. 
            reportRepository.processReports(aeReport, null, command.getReviewResult().getReportsToUnAmendList(),
                    command.getReviewResult().getReportsToWithdraw(), null);

            model.put("adverseEventReportingPeriod", command.getAdverseEventReportingPeriod().getId());
            model.put("addReportingPeriodBinder", "true");
            model.put("displayReportingPeriod", "true");
            model.put("_page", "0");
            model.put("_target1", "1");
            modelAndView = new ModelAndView("redirectToCaptureAe", model);
        }

    } else {
        //continuing to expedited flow
        if (command.getReviewResult().getAeReportId() > 0) {
            model.put("aeReport", command.getReviewResult().getAeReportId().intValue());
        }
        model.put("from", "captureAE");

        session.setAttribute("reviewResult", command.getReviewResult());
        modelAndView = new ModelAndView("redirectToExpeditedAeEdit", model);
    }

    return modelAndView;
}

From source file:com.skilrock.lms.web.roleMgmt.common.PrivsInterceptor.java

public void refreshSession(HttpSession session) {
    ServletContext sc = ServletActionContext.getServletContext();
    String sesVariables = (String) sc.getAttribute("SESSION_VARIABLES");
    List sesVar = Arrays.asList(sesVariables.split(","));

    Enumeration sesEnum = session.getAttributeNames();
    while (sesEnum.hasMoreElements()) {
        Object variable = sesEnum.nextElement();
        if (!sesVar.contains(variable.toString())) {
            session.removeAttribute(variable.toString());
        }//  w ww  . j  a v a2  s. com
    }
}

From source file:gov.nih.nci.ncicb.cadsr.umlmodelbrowser.struts.actions.BaseDispatchAction.java

/**
 * Sets default method name if no method is specified
 *
 * @return ActionForward/*from w  w  w  . java  2s . c o m*/
 *
 * @throws Exception
 */
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response, String name) throws Exception {
    if ((name == null) || name.equals("")) {
        name = DEFAULT_METHOD;
    }

    try {
        return super.dispatchMethod(mapping, form, request, response, name);
    } catch (Throwable throwable) {
        HttpSession session = request.getSession();
        String userName = request.getRemoteUser();
        if (userName == null)
            userName = "";
        Collection keys = (Collection) session.getAttribute(this.CLEAR_SESSION_KEYS);
        if (keys != null) {
            Iterator it = keys.iterator();
            while (it.hasNext()) {
                session.removeAttribute((String) it.next());
            }
        }
        if (log.isFatalEnabled()) {
            log.fatal(userName + ": Exception in dispatchMethod in method " + name, throwable);
        }
        saveError(ERROR_FATAL, request);
        throw new FatalException(throwable);
    }
}

From source file:fr.paris.lutece.plugins.crm.modules.form.service.draft.CRMDraftBackupService.java

/**
 * Remove the session attributes//from   www.jav a 2 s  .com
 * @param session the session
 */
private void removeSessionAttributes(HttpSession session) {
    session.removeAttribute(Constants.SESSION_ATTRIBUTE_ID_DEMAND_PARAMS);
    session.removeAttribute(Constants.SESSION_ATTRIBUTE_DEMAND_DATA_PARAMS);
    session.removeAttribute(Constants.SESSION_ATTRIBUTE_DEMAND_CRM_WEBB_APP_CODE_PARAMS);
    session.removeAttribute(Constants.SESSION_ATTRIBUTE_USER_GUID_PARAMS);
}

From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.web.PendingUUIDController.java

/**
 * handler of the PendingUUID url without any request parameter
 *
 * @param model   of request/*  w w w. ja  v  a  2s .c om*/
 * @param session of request
 * @param request
 * @return view name of request
 */
@RequestMapping(value = PendingUUIDReportConstants.PENDING_UUID_REPORT_URL, method = RequestMethod.GET, params = {
        "!" + BCR, "!" + CENTER, "!" + BATCH, "!" + PLATE_ID })
public String pendingUUIDReportHandler(final ModelMap model, final HttpSession session,
        final HttpServletRequest request) {
    final ModelMap pcModel = (ModelMap) session
            .getAttribute(PendingUUIDReportConstants.PENDING_UUID_REPORT_FILTER_MODEL);
    if (pcModel != null && pcModel.size() > 0) {
        model.addAllAttributes(pcModel);
    }
    final List<PendingUUID> pendingUUIDList = service.getAllPendingUUIDs();
    commonService.processDisplayTag("pendingUUID", pendingUUIDList, model, request);
    model.addAttribute(SERVER_URL, serverAddress);
    session.removeAttribute(PendingUUIDReportConstants.PENDING_UUID_REPORT_FILTER_MODEL);
    return PendingUUIDReportConstants.PENDING_UUID_REPORT_VIEW;
}

From source file:org.openmrs.module.kenyaemr.fragment.controller.ProfileLoginDetailsFragmentController.java

public void controller(FragmentModel model, HttpSession httpSession) {

    model.addAttribute("user", Context.getAuthenticatedUser());

    // If temp password is being passed, in tell view to display change password dialog
    model.addAttribute("forcePasswordChange",
            (httpSession.getAttribute(KenyaEmrWebConstants.SESSION_ATTR_RESET_PASSWORD) != null));

    model.addAttribute("changePasswordForm", newChangePasswordForm(httpSession));
    model.addAttribute("changeSecretQuestionForm", newChangeSecretQuestionForm());

    httpSession.removeAttribute(KenyaEmrWebConstants.SESSION_ATTR_RESET_PASSWORD);
}

From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.web.ProjectCaseDashboardController.java

/**
 * handler of the Project Case url without any request parameter
 *
 * @param model   of request/*from   ww w .  j a va 2 s. c om*/
 * @param session of request
 * @param request
 * @return view name of request
 */
@RequestMapping(value = ProjectCaseDashboardConstants.PROJECT_CASE_DASHBOARD_URL, method = RequestMethod.GET, params = {
        "!" + DatareportsCommonConstants.DISEASE })
public String projectCaseDashboardHandler(final ModelMap model, final HttpSession session,
        final HttpServletRequest request) {
    final ModelMap pcModel = (ModelMap) session
            .getAttribute(ProjectCaseDashboardConstants.PROJECT_CASE_DASHBOARD_FILTER_MODEL);
    if (pcModel != null && pcModel.size() > 0) {
        model.addAllAttributes(pcModel);
    }
    final List<ProjectCase> projectCaseList = service.getAllProjectCaseCounts();
    commonService.processDisplayTag("projectCase", projectCaseList, model, request);
    model.addAttribute(DatareportsCommonConstants.SERVER_URL, serverAddress);
    session.removeAttribute(ProjectCaseDashboardConstants.PROJECT_CASE_DASHBOARD_FILTER_MODEL);
    return ProjectCaseDashboardConstants.PROJECT_CASE_DASHBOARD_VIEW;
}