Example usage for javax.servlet.http HttpSession invalidate

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

Introduction

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

Prototype

public void invalidate();

Source Link

Document

Invalidates this session then unbinds any objects bound to it.

Usage

From source file:com.acc.storefront.controllers.integration.FraudUpdateController.java

@RequestMapping(value = "/integration/order_review_callback", method = RequestMethod.POST)
public void process(@RequestBody final MultiValueMap<String, String> bodyParameterMap,
        final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    initializeSiteFromRequest(request);/*from w  w  w  .j  a  v  a 2  s .c om*/

    try {
        acceleratorPaymentService.handleFraudUpdate(bodyParameterMap.toSingleValueMap());
    } finally {
        //Kill this session at the end of the request processing in order to reduce the server overhead, otherwise
        //this session will hang around until it's timed out.
        final HttpSession session = request.getSession(false);
        if (session != null) {
            session.invalidate();
        }
    }
    response.setStatus(HttpServletResponse.SC_OK);
}

From source file:com.acc.storefront.controllers.integration.MerchantCallbackController.java

@RequestMapping(value = "/integration/merchant_callback", method = RequestMethod.POST)
public void process(final HttpServletRequest request, final HttpServletResponse response) {
    initializeSiteFromRequest(request);/*  w w w .j  a v  a 2s . com*/

    try {
        acceleratorPaymentService.handleCreateSubscriptionCallback(getParameterMap(request));
    } finally {
        //Kill this session at the end of the request processing in order to reduce the server overhead, otherwise
        //this session will hang around until it's timed out.
        final HttpSession session = request.getSession(false);
        if (session != null) {
            session.invalidate();
        }
    }

    response.setStatus(HttpServletResponse.SC_OK);
}

From source file:rocks.teammolise.myunimol.webapp.login.LogoutServlet.java

/**
  * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
  * methods./*from   w  ww. j  a  va 2  s. co  m*/
  *
  * @param request servlet request
  * @param response servlet response
  * @throws ServletException if a servlet-specific error occurs
  * @throws IOException if an I/O error occurs
  */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    //il tipo di risultato della servlet
    HttpSession session = request.getSession();
    if (session != null)
        session.invalidate();
    response.sendRedirect("Login.jsp");
}

From source file:cn.lhfei.fu.web.controller.SystemController.java

@RequestMapping(value = "/logout")
public String logout(HttpSession session) {
    session.invalidate();

    return "redirect: login.do";
}

From source file:Controllers.LogoutController.java

@RequestMapping(method = RequestMethod.GET)
public String logout(HttpServletRequest request, HttpServletResponse response) {
    HttpSession session = request.getSession();

    if (session != null) {
        //session.removeAttribute("username");
        session.invalidate();

    }/*  w  w  w .j av a2s. c om*/
    return "redirect:/index.htm";
}

From source file:com.test.springmvc.springmvcproject.IndexController.java

@RequestMapping(value = "invalidate", method = RequestMethod.GET)
public String invalidateSession(HttpSession session, ModelMap map) {

    session.invalidate();
    return "redirect:/index.do";
}

From source file:com.healthcit.cacure.web.controller.LogoutController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public View processLogout(HttpServletRequest request) {

    HttpSession session = request.getSession();

    try {//from w w w  .  j av a  2s.c  om
        session.removeAttribute(Constants.CREDENTIALS);
        session.invalidate();
    } catch (Exception ex) {
        //log exception
        log.error("Error in LogoutAction", ex);
    }

    return new RedirectView(Constants.HOME_URI, true);
}

From source file:controllers.RenderController.java

@RequestMapping("logout")
public String logout(HttpSession session) {
    session.invalidate();
    return "redirect:/login.htm";
}

From source file:org.apache.drill.exec.server.rest.LogInLogOutResources.java

@GET
@Path("/logout")
public void logout(@Context HttpServletRequest req, @Context HttpServletResponse resp) throws Exception {
    final HttpSession session = req.getSession();
    if (session != null) {
        session.invalidate();
    }//from w ww  . j  a  v  a  2s.c o  m

    req.getRequestDispatcher("/").forward(req, resp);
}

From source file:org.wso2.sample.identity.oauth2.OIDCBackchannelLogoutServlet.java

protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    log.info("Backchannel logout request received.");

    String sid = null;//from   w  w  w  .  j  ava 2  s. c o  m
    try {
        sid = (String) SignedJWT.parse(req.getParameter("logout_token")).getJWTClaimsSet().getClaim("sid");
        log.info("Logout token: " + req.getParameter("logout_token"));
    } catch (ParseException e) {
        log.error("Error in generating Logout Token.", e);
    }
    HttpSession session = SessionIdStore.getSession(sid);

    if (session != null) {
        session.invalidate();
        SessionIdStore.removeSession(sid);
        log.info("Session invalidated successfully for sid: " + sid);
    } else {
        log.info("Cannot find corresponding session for sid: " + sid);
    }
}