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.alibaba.sample.petstore.web.user.module.action.LoginAction.java

public void doLogout(HttpSession session, Navigator nav, ParameterParser params) throws Exception {
    // sessionuser
    session.removeAttribute(PETSTORE_USER_SESSION_KEY);

    // return?/*from  w  w  w  .j a  v a  2  s. c o m*/
    redirectToReturnPage(nav, params);
}

From source file:com.esd.ps.LoginRegController.java

/**
 * ?//  www. ja  va2  s.  c  o m
 * 
 * @return
 */
@RequestMapping(value = "/quitReg", method = RequestMethod.GET)
public ModelAndView quitRegGet(HttpSession session) {
    session.removeAttribute(Constants.DISTRICT_NAME);
    session.removeAttribute(Constants.USER_NAME);
    session.removeAttribute(Constants.ID);
    session.removeAttribute("pinyin");
    return new ModelAndView(Constants.REDIRECT + ":" + "loginReg");
}

From source file:org.vaadin.spring.security.shared.VaadinUrlAuthenticationSuccessHandler.java

/**
 * Removes temporary authentication-related data which may have been stored in the session
 * during the authentication process.//from   www.j a  v a 2s  . com
 */
protected final void clearAuthenticationAttributes() {
    HttpSession session = http.getCurrentRequest().getSession(false);

    if (session == null) {
        return;
    }

    session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
}

From source file:de.laures.cewolf.storage.AbstractSessionStorage.java

/**
 * @param cid//from  w w  w.  j a va2  s.c o m
 * @param session
 * @return
 * @throws CewolfException
 */
protected String removeChartImage(String cid, HttpSession session) throws CewolfException {
    synchronized (session) {
        session.removeAttribute(cid);
    }
    return cid;
}

From source file:com.leapfrog.springFramework.Controller.UserController.java

@RequestMapping(value = "/admin/adduser", method = RequestMethod.POST)
public String AddUser(@RequestParam Map<String, String> parVal, HttpServletRequest request) {
    String firstname = parVal.get("firstName");
    String lastname = parVal.get("lastName");
    String username = parVal.get("username");
    String password = parVal.get("password");
    String email = parVal.get("email");
    String role = parVal.get("role");

    User user = new User();
    user.setFirstName(firstname);//w  ww.  j  a  v  a  2s . com
    user.setLastName(lastname);
    user.setUsername(username);
    user.setPassword(password);
    user.setEmail(email);
    user.setRole(role);
    User existUser = dao.checkUsername(username, password);
    if (existUser == null) {
        dao.insert(user);
        HttpSession session = request.getSession(false);
        session.removeAttribute("adminmessage");
    } else {
        String message = "UserName " + existUser.getUsername() + " already exists,Try new One";
        HttpSession session = request.getSession(true);
        session.setAttribute("adminmessage", message);

    }

    return "redirect:" + "../admin/user";

}

From source file:com.sharmila.hibernatespringsecurity.authentication.MyAuthenticationSuccessHandler.java

protected void clearAuthenticationAttribute(HttpServletRequest request) {
    HttpSession session = request.getSession();
    if (session == null) {
        return;/*from   ww w.  j a  va  2s  .co m*/
    }
    session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
}

From source file:fi.vm.kapa.identification.shibboleth.extauthn.authn.SCSAuthnHandler.java

@Override
public X509Certificate getUserCertificate(HttpServletRequest httpRequest) throws CertificateStatusException {
    X509Certificate certificate = CertificateUtil.getCertificate(httpRequest.getParameter("scs_cert"));
    if (certificate == null) {
        throw new CertificateStatusException("No valid X.509 certificates found in request", NO_CERT_FOUND);
    }//from w ww  .  j  av  a  2s  .  c  o  m

    // Check signature (original data in HTTP session)
    HttpSession session = httpRequest.getSession();
    String data = (String) session.getAttribute("scs_data");
    session.removeAttribute("scs_data");
    String signature = httpRequest.getParameter("scs_signature");

    if (StringUtils.isBlank(data) || StringUtils.isBlank(signature)) {
        throw new CertificateStatusException("SCS signature or data missing", SCS_SIGNATURE_FAILED);
    }

    boolean signatureValid = CertificateUtil.checkSignature(data, signature, certificate);
    if (!signatureValid) {
        throw new CertificateStatusException("SCS signature validity check failed", SCS_SIGNATURE_FAILED);
    }
    return certificate;
}

From source file:br.com.jreader.util.security.URLAuthenticationSuccessHandler.java

protected void clearAuthenticationAttributes(HttpServletRequest request) {
    HttpSession session = request.getSession(false);
    if (session == null) {
        return;//from  w  w  w. j av a  2s.  co  m
    }
    session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
}

From source file:com.sshdemo.common.security.web.authentication.UsernamePasswordCheckcodeAuthenticationFilter.java

/**
 * Session attribute??/*from  ww w  .  j  av a 2  s.c o m*/
 * ????
 * 
 * @param request
 */
protected void removeUsernameInSession(HttpServletRequest request) {
    HttpSession session = request.getSession(false);
    if (session != null) {
        session.removeAttribute(getUsernameParameter());
    }
}

From source file:cn.loveapple.service.controller.contents.action.SiteController.java

/**
 * /* w  ww . j  ava 2s  .com*/
 * @param session
 * @param model
 * @return
 */
@RequestMapping(value = "core/regist", method = RequestMethod.GET)
public String regist(HttpSession session, Model model) {
    session.removeAttribute(FORM);
    SiteForm form = new SiteForm();
    model.addAttribute(form);
    return "core/regist";
}