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.yj.google.SimpleSignInAdapter.java

private void removeAutheticationAttributes(HttpSession session) { //??  
    if (session == null) {
        return;/*  w w  w  .  j a v a 2s.com*/
    }
    session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
}

From source file:demo.SessionController.java

@RequestMapping("/logging")
public String logging(@RequestParam(defaultValue = "false") boolean enable, HttpSession session) {
    if (enable) {
        session.setAttribute(LoggingKey.LOGGING_KEY, "true");
    } else {/*from w  w  w  .j a  v  a2  s . com*/
        session.removeAttribute(LoggingKey.LOGGING_KEY);
    }
    return enable + "\n";
}

From source file:fi.arcusys.oulu.web.TaskManagerController.java

@RenderMapping
public String home(RenderRequest request, RenderResponse response) {
    HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(request);
    HttpSession httpSession = httpRequest.getSession();
    httpSession.removeAttribute("currentPage");
    httpSession.removeAttribute("numPerPage");
    httpSession.removeAttribute("taskType");
    httpSession.removeAttribute("keyword");
    httpSession.removeAttribute("orderType");

    return "taskmanager";
}

From source file:org.openmrs.module.conceptsearch.web.controller.ManageConceptNameFormController.java

@RequestMapping(value = "/module/conceptsearch/manageConceptName", method = RequestMethod.GET)
public void showBasicSearch(ModelMap model, WebRequest request, HttpSession session) {
    //display basicSearch.jsp   
    session.removeAttribute("searchResult");
    session.removeAttribute("sortResults");
    session.removeAttribute("conceptSearch");
}

From source file:com.pkrete.locationservice.admin.controller.mvc.EditUserController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response,
        @ModelAttribute("userInfo") UserInfo userInfo, BindingResult result) throws Exception {
    validator.validate(userInfo, result);

    if (result.hasErrors()) {
        ModelMap model = new ModelMap();
        this.setReferenceData(request, model);
        return new ModelAndView("edit_user", model);
    }//from w  w w .ja  v a  2 s . c om
    String userId = request.getParameter("select_user");

    userInfo.getUser().setUpdater(getUser(request).getUsername());
    // Updates only User
    if (!usersService.update(userInfo.getUser())) {
        throw new Exception("Updating user failed.");
    }
    // Updates only UserInfor
    if (!usersService.update(userInfo)) {
        throw new Exception("Updating user info failed.");
    }

    HttpSession session = request.getSession();
    session.removeAttribute("user");
    session.setAttribute("user", usersService.getUser(request.getRemoteUser()));

    return new ModelAndView("redirect:userowner.htm?select_user=" + userId);
}

From source file:mvc.controller.LoginController.java

@RequestMapping("/efetuaLogin")
public String efetuaLogin(Usuario user, HttpSession session) {
    if (dao.validaUsuario(user)) {
        session.setAttribute("usuarioLogado", user);
        session.removeAttribute("msgLoginInvalido");
        return "menuAdm";
    } else {/*from   w w  w  . j  ava  2s. com*/
        session.setAttribute("msgLoginInvalido", "O login no foi validado!");
        return "redirect:formLogin";
    }

}

From source file:com.athena.peacock.controller.web.user.UserController.java

@RequestMapping("/logout")
public @ResponseBody SimpleJsonResponse logout(SimpleJsonResponse jsonRes, HttpSession session) {

    session.removeAttribute(SESSION_USER_KEY);

    jsonRes.setMsg("logout success.");

    return jsonRes;
}

From source file:com.naver.timetable.bo.LoginBO.java

public void logout(HttpServletRequest request) {
    HttpSession session = request.getSession();
    if (session.getAttribute("user") != null) {
        session.removeAttribute("user");
    }//from  w ww .ja v a 2 s.c o m
}

From source file:org.callistasoftware.netcare.api.rest.UserApi.java

@RequestMapping(value = "/unselect", method = RequestMethod.POST, produces = "application/json")
@ResponseBody/*from  w w  w .j av  a  2s. c  o m*/
public ServiceResult<PatientBaseView> unselect(final HttpSession session) {
    session.removeAttribute("currentPatient");
    return ServiceResultImpl.createSuccessResult(null, new GenericSuccessMessage());
}

From source file:org.appverse.web.framework.backend.test.util.frontfacade.mvc.tests.predefined.TestCsrfTokenRepository.java

@Override
public void saveToken(CsrfToken token, HttpServletRequest request, HttpServletResponse response) {
    if (token == null) {
        HttpSession session = request.getSession(false);
        if (session != null) {
            session.removeAttribute(sessionAttributeName);
        }//w w  w.j  a v  a  2 s.c  o  m
    } else {
        HttpSession session = request.getSession();
        session.setAttribute(sessionAttributeName, token);
    }
}