List of usage examples for javax.servlet.http HttpSession removeAttribute
public void removeAttribute(String name);
From source file:com.github.rollercage.CageCommentAuthenticator.java
@Override public boolean authenticate(javax.servlet.http.HttpServletRequest req) { boolean authentic = false; HttpSession session = req.getSession(false); String answer = req.getParameter(ANSWER); if (answer != null && session != null && answer.equals(session.getAttribute(TOKEN))) { authentic = true;//from ww w .jav a2 s . com session.removeAttribute(TOKEN); } return authentic; }
From source file:com.ateam.login.UserSession.java
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { HttpSession session = ((HttpServletRequest) request).getSession(); String redirectUrl = (String) session.getAttribute(LAST_URL_REDIRECT_KEY); if (isAuthenticated() && (redirectUrl != null) && !redirectUrl.isEmpty()) { session.removeAttribute(LAST_URL_REDIRECT_KEY); HttpServletResponse resp = (HttpServletResponse) response; resp.sendRedirect(redirectUrl);/*from ww w . ja v a 2 s . c om*/ } else { chain.doFilter(request, response); } }
From source file:net.ymate.framework.core.support.TokenProcessHelper.java
/** * Reset the saved transaction token in the user's session. This * indicates that transactional token checking will not be needed on the * next request that is submitted./* w w w .j a va2s .com*/ * * @param request The servlet request we are processing */ public synchronized void resetToken(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute(TRANSACTION_TOKEN_KEY); } }
From source file:net.ymate.framework.core.support.TokenProcessHelper.java
public synchronized void resetToken(HttpServletRequest request, String name) { if (StringUtils.trimToNull(name) == null) { throw new NullArgumentException(name); }// w ww.j a va 2 s. c om HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute(TRANSACTION_TOKEN_KEY + "|" + name); } }
From source file:nl.isaac.dotcms.searcher.servlet.SearcherServlet.java
private void clearSearcherSession(HttpServletRequest req, HttpServletResponse resp) throws IOException { HttpSession session = req.getSession(); String redirectTo = req.getParameter("redirectPage"); if (session != null && !StringUtils.isBlank(redirectTo)) { session.removeAttribute("searcher_filteredResults"); session.removeAttribute("pageSize"); UserSearchValues.getAttributeKeys().forEach((attributeKey) -> { session.removeAttribute(attributeKey); });//from w ww . j av a2s. c o m Logger.info(this, "Cleared Searcher Session!"); resp.sendRedirect(redirectTo.replaceAll(PAGE_QUERY_PARAM_REGEX, "")); } else { Logger.info(this, "Session or RedirectPage is not found in URL..."); } }
From source file:Controladores.controladorProjeto.java
private void limpaSessaoFuncProjeto(HttpSession sessao) { if (sessao.getAttribute("funcProjeto") != null) { sessao.removeAttribute("funcProjeto"); }//from ww w. j a va 2 s .co m }
From source file:org.openmrs.module.rwandaprimarycare.LoginController.java
@RequestMapping("logout.form") public String logoutUser(ModelMap model, HttpSession session, HttpServletRequest request, HttpServletResponse response) {// w ww .j a v a2 s . co m try { Context.logout(); session.removeAttribute(WebConstants.OPENMRS_USER_CONTEXT_HTTPSESSION_ATTR); session.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "auth.logged.out"); session.setAttribute(WebConstants.OPENMRS_LOGIN_REDIRECT_HTTPSESSION_ATTR, request.getContextPath()); session.invalidate(); return "redirect:login.form"; } catch (Exception e) { //TODO log.error("Uexpected auth error", e); } return "redirect:login.form"; }
From source file:org.openmrs.module.bom.web.controller.LoginPageOverrideController.java
@RequestMapping("/module/bom/logout.htm") public String logoutUser(ModelMap model, HttpSession session, HttpServletRequest request, HttpServletResponse response) {/*from w ww .jav a 2 s . c om*/ try { Context.logout(); session.removeAttribute(WebConstants.OPENMRS_USER_CONTEXT_HTTPSESSION_ATTR); session.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "auth.logged.out"); session.setAttribute(WebConstants.OPENMRS_LOGIN_REDIRECT_HTTPSESSION_ATTR, request.getContextPath()); session.invalidate(); return "/module/bom/bomLogin"; } catch (Exception e) { //TODO log.error("Uexpected auth error", e); } return "/module/bom/bomLogin"; }
From source file:com.flying.services.CarOwnerUserServices.java
/** * //from w w w. j a va2 s.com */ public void logout(HttpSession session) { session.removeAttribute("carOwnerUser"); //shiro? try { SecurityUtils.getSubject().logout();// } catch (Exception e) { } }
From source file:com.roncoo.pay.controller.login.LoginController.java
/** * . ?? /*w w w. j a v a2 s. co m*/ * * @? @return * @return String * @throws */ @RequestMapping(value = "/admin/logout", method = RequestMethod.POST) public String logout(HttpServletRequest request, Model model) { // ?form????,?newDwzAjax DwzAjax dwz = new DwzAjax(); try { HttpSession session = request.getSession(); session.removeAttribute("employee"); LOG.info("***clean session success!***"); } catch (Exception e) { LOG.error(e); dwz.setStatusCode(DWZ.ERROR); dwz.setMessage("??"); model.addAttribute("dwz", dwz); return "admin.common.ajaxDone"; } return "admin.login"; }