Example usage for javax.servlet.http HttpServletRequest getSession

List of usage examples for javax.servlet.http HttpServletRequest getSession

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getSession.

Prototype

public HttpSession getSession();

Source Link

Document

Returns the current session associated with this request, or if the request does not have a session, creates one.

Usage

From source file:io.muic.ooc.service.SecurityService.java

public static void logout(HttpServletRequest request) {
    request.getSession().invalidate();
}

From source file:org.sarons.spring4me.web.page.utils.PageConfigUtils.java

public static PageConfig getPageConfig(HttpServletRequest request) {
    return (PageConfig) request.getSession().getAttribute(PageConfig.KEY);
}

From source file:org.sarons.spring4me.web.page.utils.PageConfigUtils.java

public static void setPageConfig(HttpServletRequest request, PageConfig pageConfig) {
    request.getSession().setAttribute(PageConfig.KEY, pageConfig);
}

From source file:io.muic.ooc.service.SecurityService.java

public static boolean isAuthorized(HttpServletRequest request) {
    String username = (String) request.getSession().getAttribute("username");
    return (username != null && DatabaseQueryService.isAuthorized(username));
}

From source file:alfio.controller.support.SessionUtil.java

public static void savePromotionCodeDiscount(String promoCodeDiscount, HttpServletRequest request) {
    request.getSession().setAttribute(PROMOTIONAL_CODE_DISCOUNT, promoCodeDiscount);
}

From source file:alfio.controller.support.SessionUtil.java

public static void removeSpecialPriceData(HttpServletRequest request) {
    request.getSession().removeAttribute(SPECIAL_PRICE_CODE_SESSION_ID);
    request.getSession().removeAttribute(SPECIAL_PRICE_CODE);
    request.getSession().removeAttribute(PROMOTIONAL_CODE_DISCOUNT);
}

From source file:com.liusoft.dlog4j.servlet.DLOG_RandomImageServlet.java

public static String getRandomLoginKey(HttpServletRequest req) {
    return (String) req.getSession().getAttribute(Globals.RANDOM_LOGIN_KEY);
}

From source file:edu.cornell.mannlib.vitro.webapp.auth.policy.RequestPolicyList.java

/**
 * Get a copy of the current list of policies. This includes the policies in
 * the ServletContext, followed by any stored in the request. This method may
 * return an empty list, but it never returns null.
 *//*from  ww w.j a v  a  2 s . co  m*/
public static PolicyList getPolicies(HttpServletRequest request) {
    ServletContext ctx = request.getSession().getServletContext();

    PolicyList list = ServletPolicyList.getPolicies(ctx);
    list.addAll(getPoliciesFromRequest(request));
    return list;
}

From source file:com.nabla.wapp.server.general.UserSession.java

public static void clear(final HttpServletRequest request) {
    request.getSession().removeAttribute(SESSION_PARAMETER_NAME);
}

From source file:com.mobileman.projecth.web.util.CaptchaUtil.java

static public boolean verify(HttpServletRequest request, Model model) {
    Captcha captcha = (Captcha) request.getSession().getAttribute(Captcha.NAME);
    String answer = request.getParameter("captchaAnswer");
    if (captcha.isCorrect(answer)) {
        return true;
    }//from w ww.  jav a 2  s  .co m
    model.addAttribute(KEY_ERROR, true);
    return false;
}