Example usage for javax.servlet.http HttpServletResponse addCookie

List of usage examples for javax.servlet.http HttpServletResponse addCookie

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse addCookie.

Prototype

public void addCookie(Cookie cookie);

Source Link

Document

Adds the specified cookie to the response.

Usage

From source file:net.mindengine.oculus.frontend.web.Auth.java

public static void removeUserCookie(HttpServletResponse response) {
    response.addCookie(createCookie("_u", "", 0, "/"));
}

From source file:net.mindengine.oculus.frontend.web.Auth.java

public static void setUserCookieToResponse(HttpServletResponse response, User user) throws Exception {
    response.addCookie(createCookie("_u", encodeUser(user), COOKIE_MAX_AGE, "/"));
}

From source file:com.usefullc.platform.common.utils.CookieUtils.java

/**
 * cookie/* w  ww  .  ja va 2  s .c  o  m*/
 * 
 * @param request
 * @param response
 * @param name
 */
public static void remove(String name, String domain) {
    Cookie cookie = new Cookie(name, "");
    cookie.setPath("/");
    cookie.setMaxAge(0);
    cookie.setDomain(domain);
    HttpServletResponse response = ServeltContextManager.getResponse();
    response.addCookie(cookie);
}

From source file:com.eryansky.common.web.utils.RequestUtil.java

public static void deleteCookie(HttpServletResponse response, Cookie cookie, String path) {
    if (cookie != null) {
        cookie.setMaxAge(0);//from   w w  w  .  jav a2 s. c o m
        cookie.setPath(path);
        response.addCookie(cookie);
    }
}

From source file:org.tsm.concharto.auth.AuthHelper.java

public static void setCookie(HttpServletResponse response, String cookieName, int maxAge, String value) {
    Cookie cookie = new Cookie(cookieName, value);
    cookie.setMaxAge(maxAge);//from w w w. j a v  a2  s .  c  om
    response.addCookie(cookie);
}

From source file:CookieUtils.java

/**
 * Adds a cookie with the specified name, value and expiry.
 *
 * @param response    the HttpServletResponse to add the cookie to
 * @param name        the name of the cookie
 * @param value       the value of the cookie
 * @param maxAge      the maxAge of the cookie (in seconds)
 *//*from   www. j  a  v a  2  s.  c  o  m*/
public static void addCookie(HttpServletResponse response, String name, String value, int maxAge) {
    Cookie cookie = new Cookie(name, value);
    cookie.setMaxAge(maxAge);
    response.addCookie(cookie);
}

From source file:org.examproject.tweet.controller.SettingController.java

private static void storeTokenToCookie(TweetForm tweetForm, HttpServletResponse response, int maxAge) {
    Cookie cookie = new Cookie(TweetCookie.USER_LIST_NAME.getName(), tweetForm.getUserListName());
    cookie.setMaxAge(maxAge);/*from w ww.  j a  v  a 2s .c  om*/
    response.addCookie(cookie);

    cookie = new Cookie(TweetCookie.RESPONSE_LIST_MODE.getName(), tweetForm.getResponseListMode());
    cookie.setMaxAge(maxAge);
    response.addCookie(cookie);
}

From source file:com.kamike.misc.CookieUtils.java

/**
 *
 * COOKIE//from www  . jav  a 2s  .com
 *
 *
 *
 * @param name
 *
 * @param value
 *
 * @param maxAge
 *
 */
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String name,
        String value, int maxAge) {

    Cookie cookie = new Cookie(name, value);

    cookie.setMaxAge(maxAge);

    cookie.setPath("/");

    response.addCookie(cookie);

}

From source file:com.wikipy.security.AuthenticationFilter.java

public static Cookie createNewCookie(HttpServletResponse httpResp) {
    Cookie cookie = new Cookie(ARG_TICKET, UUID.randomUUID().toString());
    cookie.setMaxAge(24 * 60 * 60);// w w w.j  a va  2s .  c o m
    cookie.setPath("/");
    httpResp.addCookie(cookie);
    return cookie;
}

From source file:org.apache.accumulo.monitor.servlets.BasicServlet.java

public static final void setCookie(HttpServletResponse resp, String name, String value) {
    resp.addCookie(new Cookie(name, value));
}