Example usage for javax.servlet.http Cookie Cookie

List of usage examples for javax.servlet.http Cookie Cookie

Introduction

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

Prototype

public Cookie(String name, String value) 

Source Link

Document

Constructs a cookie with the specified name and value.

Usage

From source file:es.pode.visualizador.presentacion.modificarPerfil.ModificarPerfilControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.modificarPerfil.ModificarPerfilController#modificarUsuarioMismo(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.modificarPerfil.ModificarUsuarioMismoForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//*  w  ww . j  a v  a2 s .  c  o  m*/
public final void modificarUsuarioMismo(ActionMapping mapping,
        es.pode.visualizador.presentacion.modificarPerfil.ModificarUsuarioMismoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    String resultado = null;
    try {
        //String idiomaSelected = LdapUserDetailsUtils.getIdioma();
        String nombre = request.getParameter("nombre");
        String apellido1 = request.getParameter("apellido1");
        Long id = Long.valueOf(request.getParameter("id"));
        String apellido2 = request.getParameter("apellido2");
        String email = request.getParameter("email");
        String idioma = request.getParameter("idioma");
        String idiomaBusqueda = request.getParameter("idiomaBusqueda");
        String tipoEmpaquetador = request.getParameter("tipoEmpaquetador");
        String clave = request.getParameter("clave");
        String openIdUrl = request.getParameter("openIdUrl");
        String repitaClave = request.getParameter("repitaClave");
        String tipoCatalogador = request.getParameter("tipoCatalogador");
        long cuota = 0;
        Matcher matcher = null;
        if (request.getParameter("cuota").length() > 0) {
            Pattern maskNum = Pattern.compile("[0-9]+");
            matcher = maskNum.matcher(request.getParameter("cuota"));
            if (!matcher.matches()) {
                if (log.isDebugEnabled())
                    log.debug("cuota caracter ilegal");
                throw new ValidatorException("{errors.modificarusuario.cuota}");
            }
            cuota = Long.valueOf(request.getParameter("cuota")).longValue();
            cuota = cuota * 1024 * 1024;
        }

        UsuarioVO usuarioVO = this.getSrvAdminUsuariosService().descripcionUsuario(id);
        // Validaciones de los campos que recogemos del formulario
        Pattern mask = Pattern.compile("[^\\\\?\\\\!\\>\\#\\&\\<\\@\\$\\/\\\'\\\"]+");
        // Validaciones para password
        Pattern maskPwd = Pattern.compile("[^\\\\?\\\\!\\>\\#\\&\\<\\@\\$\\/\\\'\\\"]+");

        if (nombre.length() <= 0) {
            log("nombre.length() <= 0");
            throw new ValidatorException("{errors.modificarusuario.nombre}");
        }
        matcher = mask.matcher(nombre);
        if (!matcher.matches()) {
            log("nombre caracter ilegal");

            throw new ValidatorException("{errors.modificarusuario.nombre.caracterIlegal}");
        }

        if (apellido1.length() <= 0) {
            log("apellido1.length() <= 0");

            throw new ValidatorException("{errors.modificarusuario.apellido1}");
        }
        matcher = mask.matcher(apellido1);
        if (!matcher.matches()) {
            log("apellido1 caracter ilegal");
            throw new ValidatorException("{errors.modificarusuario.apellido1.caracterIlegal}");
        }
        if (apellido2.length() > 0) {
            matcher = mask.matcher(apellido2);
            if (!matcher.matches()) {
                log("apellido2 caracter ilegal");
                throw new ValidatorException("{errors.modificarusuario.apellido2.caracterIlegal}");
            }
        }
        /*
         * if (apellido2.length() <= 0) { log("apellido2.length() <=
         * 0");
         * 
         * throw new
         * ValidatorException("{errors.modificarusuario.apellido2}"); }
         * matcher = mask.matcher(apellido2); if (!matcher.matches()) {
         * log("apellido2 caracter ilegal"); throw new
         * ValidatorException("{errors.altausuario.modificarusuario.caracterIlegal}"); }
         */
        if (email.length() <= 0) {
            log("email.length() <= 0");
            throw new ValidatorException("{errors.modificarusuario.email}");
        }
        if (!((email.indexOf("@") > 0) && (email.indexOf(".") > 0))) {
            throw new ValidatorException("{errors.modificarusuario.emailIncorrecto}");
        }

        if ((clave == null) || (clave.equalsIgnoreCase(""))) {
            log("No se modifica la clave");
        } else {
            if (clave.length() < 7) {
                log("clave .length() <= 7");
                throw new ValidatorException("{errors.modificarusuario.clave}");
            }

            matcher = maskPwd.matcher(clave);
            if (!matcher.matches()) {
                log("contrasea caracter ilegal");
                throw new ValidatorException("{errors.modificarusuario.clave.caracterIlegal}");
            }

            if (!(clave.equalsIgnoreCase(repitaClave))) {
                throw new ValidatorException("{errors.modificarusuario.claveDistintas}");
            }
            usuarioVO.setClave(clave);
        }
        if (openIdUrl != null && openIdUrl.length() > 0) {
            UsuarioVO usuariovo = this.getSrvAdminUsuariosService().obtenerUsuarioConOpenId(openIdUrl);
            if (usuariovo != null && !usuariovo.getUsuario().equals(usuarioVO.getUsuario())) {
                if (log.isDebugEnabled())
                    log.debug("Ese identificador de openId ya existe en la base de datos");
                throw new ValidatorException("{errors.altausuario.existe.openId}");
            }

        }
        if (idiomaBusqueda == null) {
            throw new ValidatorException("{errors.modificarusuario.idiomaBusqueda}");
        }
        if (idiomaBusqueda.length() <= 0) {
            log("empaquetador .length() <= 0");
            throw new ValidatorException("{errors.modificarusuario.idiomaBusqueda}");
        }

        if (idioma == null) {
            throw new ValidatorException("{errors.modificarusuario.idioma}");
        }
        if (idioma.length() <= 0) {
            log("empaquetador .length() <= 0");
            throw new ValidatorException("{errors.modificarusuario.idioma}");
        }

        if (tipoEmpaquetador == null) {
            throw new ValidatorException("{errors.modificarusuario.tipoEmpaquetador}");
        }
        if (tipoEmpaquetador.length() <= 0) {
            log("empaquetador .length() <= 0");
            throw new ValidatorException("{errors.modificarusuario.tipoEmpaquetador}");
        }

        // /////Fin de validaciones de campo //////////

        usuarioVO.setNombre(nombre);
        usuarioVO.setApellido1(apellido1);
        usuarioVO.setApellido2(apellido2);
        usuarioVO.setEmail(email);
        usuarioVO.setTipoEmpaquetador(tipoEmpaquetador);
        usuarioVO.setIdioma(idioma);
        usuarioVO.setIdiomaBusqueda(idiomaBusqueda);
        usuarioVO.setTipoCatalogador(tipoCatalogador);
        usuarioVO.setCuota(new Long(cuota));
        usuarioVO.setOpenIdUrl(openIdUrl);

        usuarioVO.setId(id);
        resultado = this.getSrvAdminUsuariosService().modificarUsuario(usuarioVO);
        // Fijamos la cookie de modificarPerfil
        String cookiesPerfil = this.getPropertyValue("cookieModificarPerfil");
        Long tiempo = new Long(System.currentTimeMillis());
        Cookie cookie = new Cookie(cookiesPerfil, tiempo.toString());
        cookie.setPath("/");
        response.addCookie(cookie);
        log("se ha creado la cookie MODIFICAR_PERFIL " + tiempo);
    } catch (ValidatorException ve) {
        log.error("se ha producido una validatorException");
        resultado = "FALLO.MODIFICARUSUARIO";
        throw ve;
    } catch (Exception e) {
        log.error("Error: " + e);
        resultado = "FALLO.MODIFICARUSUARIO";
        throw new ValidatorException("{modificarUsuario.error}");

    } finally {

        // /Elimino de la sesion la descripcion del grupo

        form.setResultadoModificacion(resultado);
    }

}

From source file:fr.paris.lutece.plugins.mylutece.modules.oauth.authentication.OAuthAuthentication.java

/**
 * Creates a cookie// www  . jav a 2  s  .  c o  m
 * @param strKey the cookie name
 * @param strValue the value
 */
private void createCookie(String strKey, String strValue) {
    Cookie cookie = new Cookie(strKey, strValue);
    LocalVariables.getResponse().addCookie(cookie);
}

From source file:org.itracker.web.util.LoginUtilities.java

public static User setupSession(User user, String encPassword, HttpServletRequest request,
        HttpServletResponse response) {/*from w w  w  .j  a v a2s  . c o m*/
    if (user == null) {
        logger.warn("setupSession: null user", (logger.isDebugEnabled() ? new RuntimeException() : null));
        throw new IllegalArgumentException("null user");
    }

    UserService userService = ServletContextUtils.getItrackerServices().getUserService();

    if (logger.isDebugEnabled()) {
        logger.debug("Creating new session");
    }
    HttpSession session = request.getSession(true);

    if (logger.isDebugEnabled()) {
        logger.debug("Setting session timeout to " + getConfiguredSessionTimeout() + " minutes");
    }
    session.setMaxInactiveInterval(getConfiguredSessionTimeout() * 60);

    if (logger.isDebugEnabled()) {
        logger.debug("Setting session tracker");
    }
    session.setAttribute(Constants.SESSION_TRACKER_KEY, new SessionTracker(user.getLogin(), session.getId()));

    if (logger.isDebugEnabled()) {
        logger.debug("Setting user information");
    }
    session.setAttribute(Constants.USER_KEY, user);

    if (logger.isDebugEnabled()) {
        logger.debug("Setting preferences for user " + user.getLogin());
    }
    UserPreferences userPrefs = user.getPreferences();
    // TODO : this is a hack, remove when possible
    if (userPrefs == null) {
        logger.warn("setupSession: got user with no preferences!: " + user + " (prefs: " + user.getPreferences()
                + ")");
        userPrefs = new UserPreferences();
    }
    session.setAttribute(Constants.PREFERENCES_KEY, userPrefs);

    if (logger.isDebugEnabled()) {
        logger.debug("Setting user " + user + " locale to "
                + ITrackerResources.getLocale(userPrefs.getUserLocale()));
    }
    session.setAttribute(Constants.LOCALE_KEY, ITrackerResources.getLocale(userPrefs.getUserLocale()));

    // TODO: cookie could be removed
    Cookie cookie = new Cookie(Constants.COOKIE_NAME, "");
    cookie.setPath(request.getContextPath());

    cookie.setValue("");
    cookie.setMaxAge(0);

    response.addCookie(cookie);

    if (logger.isDebugEnabled()) {
        logger.debug("Setting permissions for user " + user.getLogin());
    }
    Map<Integer, Set<PermissionType>> usersMapOfProjectIdsAndSetOfPermissionTypes = userService
            .getUsersMapOfProjectIdsAndSetOfPermissionTypes(user, AuthenticationConstants.REQ_SOURCE_WEB);
    session.setAttribute(Constants.PERMISSIONS_KEY, usersMapOfProjectIdsAndSetOfPermissionTypes);

    // Reset some session forms
    session.setAttribute(Constants.SEARCH_QUERY_KEY, null);

    SessionManager.clearSessionNeedsReset(user.getLogin());
    if (logger.isDebugEnabled()) {
        logger.debug("User session data updated.");
    }
    return user;
}

From source file:net.nan21.dnet.core.web.controller.ui.extjs.AbstractUiExtjsController.java

private Cookie createCookie(String name, String value, int age) {
    Cookie c = new Cookie(name, value);
    c.setMaxAge(age);
    return c;
}

From source file:fr.paris.lutece.plugins.mylutece.modules.openam.service.OpenamService.java

/**
 * set a paris connect cokkie in the HttpServletResponse
 *
 * @param strPCUID/*from w w  w. j  a va  2  s  .co  m*/
 *            the user PCUID
 * @param response
 *            The HTTP response
 */
public void removeConnectionCookie(HttpServletResponse response) {
    // remove  openam cookie using the setMaxAgeParameters
    Cookie openamCookie = new Cookie(COOKIE_OPENAM_NAME, null);
    openamCookie.setDomain(COOKIE_OPENAM_DOMAIN);
    openamCookie.setSecure(COOKIE_OPENAM_SECURE);
    openamCookie.setMaxAge(0);
    openamCookie.setPath(COOKIE_OPENAM_PATH);
    response.addCookie(openamCookie);
}

From source file:com.codeabovelab.dm.gateway.proxy.common.HttpProxy.java

/**
 * Copy cookie from the proxy to the servlet client.
 * Replaces cookie path to local path and renames cookie to avoid collisions.
 *///from www .ja v  a2 s . c om
private void copyProxyCookie(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
        Header header) {
    List<HttpCookie> cookies = HttpCookie.parse(header.getValue());
    String path = servletRequest.getContextPath(); // path starts with / or is empty string
    path += servletRequest.getServletPath(); // servlet path starts with / or is empty string
    for (int i = 0, l = cookies.size(); i < l; i++) {
        HttpCookie cookie = cookies.get(i);
        //set cookie name prefixed w/ a proxy value so it won't collide w/ other cookies
        String proxyCookieName = getCookieNamePrefix() + cookie.getName();
        Cookie servletCookie = new Cookie(proxyCookieName, cookie.getValue());
        servletCookie.setComment(cookie.getComment());
        servletCookie.setMaxAge((int) cookie.getMaxAge());
        servletCookie.setPath(path); //set to the path of the proxy servlet
        // don't set cookie domain
        servletCookie.setSecure(cookie.getSecure());
        servletCookie.setVersion(cookie.getVersion());
        servletResponse.addCookie(servletCookie);
    }
}

From source file:com.openvcx.webcall.ConferenceCreateServlet.java

/**
 * <p>Lookup a client conference number stored in a cookie. If no phone number is provided by the client a random SIP URI phone number is automatically generated.</p>
 * <p>A conference definition template file is used to create the conference definition for the phone number.</p>
 * <p>The auto-assigned phone number is then stored in a cookie and returned to the client.</p>
 * @param out standard output Output writer
 * @param request The HTTP request object
 * @param response The HTTP response object
 *//*from  ww  w  .  j  a v  a  2s. com*/
private boolean doCreateNumber(PrintWriter out, HttpServletRequest request, HttpServletResponse response)
        throws IOException {
    String strOutputNumber = null;

    Cookie[] arrCookies = request.getCookies();
    if (null != arrCookies) {
        for (Cookie cookie : arrCookies) {
            //logger.debug("cookie name: " + cookie.getName() + ", path: " + cookie.getPath() + ", domain: " + cookie.getDomain() + ", maxAge: " + cookie.getMaxAge() + ", value: " + cookie.getValue());
            if (COOKIE_NUMBER_KEY.equals(cookie.getName())) {
                if (null != (strOutputNumber = cookie.getValue()) && strOutputNumber.length() == 0) {
                    strOutputNumber = null;
                }
                logger.debug("Using cookie stored conference output number: '" + strOutputNumber + "'.");
                break;
            }
        }
    }

    strOutputNumber = createConferenceDefinition(strOutputNumber);

    if (null != strOutputNumber) {

        int cookieAgeDays = 7;
        Cookie cookie = new Cookie(COOKIE_NUMBER_KEY, strOutputNumber);
        cookie.setMaxAge(cookieAgeDays * SECONDS_IN_DAY);
        cookie.setPath("/" + getUriDirSegment(request.getRequestURI(), 0) + "/");
        logger.debug("Setting cookie " + COOKIE_NUMBER_KEY + "=" + strOutputNumber);
        response.addCookie(cookie);
        out.println("number=" + strOutputNumber);
    }

    return true;
}

From source file:com.shishu.utility.string.StringUtil.java

public static void setCookie(HttpServletResponse response, String CookieName, String CookieVal, int CookieAge)
        throws UnsupportedEncodingException {
    Cookie cookie = new Cookie(CookieName, URLEncoder.encode(CookieVal, "utf-8"));
    cookie.setMaxAge(CookieAge);//from  ww  w .  j  a  va2  s.c  om
    cookie.setPath("/");
    response.addCookie(cookie);
}

From source file:fi.hoski.web.forms.RaceEntryServlet.java

/**
 * Handles the HTTP//from ww w.jav a  2 s.com
 * <code>POST</code> method.
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    try {
        String raceFleetKeyStr = request.getParameter("RaceFleetKey");
        if (raceFleetKeyStr == null) {
            throw new ServletException("no RaceFleetKey");
        }
        Key raceFleetKey = KeyFactory.stringToKey(raceFleetKeyStr);
        Entity raceFleetEntity = datastore.get(raceFleetKey);
        Key raceSeriesKey = raceFleetKey.getParent();
        Entity raceseriesEntity = datastore.get(raceSeriesKey);
        RaceSeries raceSeries = (RaceSeries) entities.newInstance(raceseriesEntity);
        RaceFleet raceFleet = (RaceFleet) entities.newInstance(raceFleetEntity);
        RaceEntry raceEntry = new RaceEntry(raceFleet);
        raceEntry.populate(request.getParameterMap());

        String fn = request.getParameter(RaceEntry.FIRSTNAME);
        String ln = request.getParameter(RaceEntry.LASTNAME);
        raceEntry.set(RaceEntry.HELMNAME, fn + " " + ln);

        String sa = request.getParameter(RaceEntry.STREETADDRESS);
        String zc = request.getParameter(RaceEntry.ZIPCODE);
        String ct = request.getParameter(RaceEntry.CITY);
        String cn = request.getParameter(RaceEntry.COUNTRY);
        if (cn == null || cn.isEmpty()) {
            raceEntry.set(RaceEntry.HELMADDRESS, sa + ", " + zc + " " + ct);
        } else {
            raceEntry.set(RaceEntry.HELMADDRESS, sa + ", " + zc + " " + ct + ", " + cn);
        }

        Day closingDay = (Day) raceSeries.get(RaceSeries.ClosingDate);
        Number fee = 0.0;
        if (closingDay != null) {
            Day now = new Day();
            if (closingDay.before(now)) {
                fee = (Number) raceFleet.get(RaceFleet.Fee2);
            } else {
                fee = (Number) raceFleet.get(RaceFleet.Fee);
            }
        }
        Boolean clubDiscount = (Boolean) raceSeries.get(RaceSeries.CLUBDISCOUNT);
        String clubname = repositoryBundle.getString("Clubname");
        if (clubDiscount != null && clubDiscount
                && clubname.equalsIgnoreCase("" + raceEntry.get(RaceEntry.CLUB))) {
            fee = new Double(0);
        }
        raceEntry.set(RaceEntry.FEE, fee);
        raceEntry.set(RaceEntry.TIMESTAMP, new Date());

        entities.put(raceEntry);

        String payingInstructions = "";
        String payingInstructionsHtml = "";
        BankingBarcode bb = races.getBarcode(raceEntry);
        if (bb != null) {
            Day dueDay = new Day(bb.getDueDate());
            String payingFormat = EntityReferences.encode(msg(Messages.RACEENTRYPAYING), "UTF-8");
            String bic = EntityReferences.encode(msg(Messages.RACEBIC), "UTF-8");
            payingInstructions = String.format(payingFormat, bb.toString(), // 1 = barcode
                    bb.getAccount().getIBAN(), // 2 = account
                    bb.getReference().toFormattedRFString(), // 3 = ref
                    dueDay, // 4 = due date
                    String.format("%.2f", bb.getTotal()), // 5 = total
                    bic // 6 = bic
            );
            payingInstructionsHtml = String.format(payingFormat.replace("\n", "<br>"),
                    "<span id='barcode'>" + bb.toString() + "</span>", // 1 = barcode
                    "<span id='iban'>" + bb.getAccount().getIBAN() + "</span>", // 2 = account
                    "<span id='rf'>" + bb.getReference().toFormattedRFString() + "</span>", // 3 = ref
                    "<span id='due'>" + dueDay + "</span>", // 4 = due date
                    "<span id='fee'>" + String.format("%.2f", bb.getTotal()) + "</span>", // 5 = total
                    "<span id='bic'>" + bic + "</span>" // 6 = bic
            );
        }
        URL base = new URL(request.getRequestURL().toString());
        URL barcodeUrl = new URL(base, "/races/code128.html?ancestor=" + raceEntry.createKeyString());
        String name = (String) raceEntry.get(RaceEntry.HELMNAME);
        String email = (String) raceEntry.get(RaceEntry.HELMEMAIL);
        String confirmation = msg(Messages.RACEENTRYCONFIRMATION);
        String plainMessage = "";
        String htmlMessage = "<html><head></head><body>" + EntityReferences.encode(confirmation)
                + payingInstructionsHtml + raceEntry.getFieldsAsHtmlTable() + "<iframe src="
                + barcodeUrl.toString() + "/>" + "</body></html>";
        if (email != null) {
            InternetAddress recipient = new InternetAddress(email, name);
            String senderStr = msg(Messages.RACEENTRYFROMADDRESS);
            InternetAddress sender;
            try {
                sender = new InternetAddress(senderStr);
                plainMessage = confirmation + "\n" + payingInstructions + "\n" + raceEntry.getFields();

                String subject = msg(Messages.RACEENTRYSUBJECT);
                mailService.sendMail(sender, subject, plainMessage, htmlMessage, recipient);
            } catch (Exception ex) {
                log(senderStr, ex);
            }
        }
        Cookie cookie = null;
        Cookie[] cookies = null;
        if (useCookies) {
            cookies = request.getCookies();
        }
        if (cookies != null) {
            for (Cookie ck : cookies) {
                if (COOKIENAME.equals(ck.getName())) {
                    cookie = ck;
                }
            }
        }
        JSONObject json = null;
        if (useCookies && cookie != null) {
            Base64 decoder = new Base64();
            String str = new String(decoder.decode(cookie.getValue()));
            json = new JSONObject(str);
        } else {
            json = new JSONObject();
        }
        for (Map.Entry<String, String[]> entry : ((Map<String, String[]>) request.getParameterMap())
                .entrySet()) {
            String property = entry.getKey();
            String[] values = entry.getValue();
            if (values.length == 1) {
                json.put(property, values[0]);
            }
        }
        Base64 encoder = new Base64();
        String base64 = encoder.encodeAsString(json.toString().getBytes("UTF-8"));
        if (useCookies) {
            if (cookie == null) {
                cookie = new Cookie(COOKIENAME, base64);
                cookie.setPath("/");
                cookie.setMaxAge(400 * 24 * 60 * 60);
            } else {
                cookie.setValue(base64);
            }
            response.addCookie(cookie);
        }
        sendError(response, HttpServletResponse.SC_OK,
                "<div id=\"" + raceEntry.createKeyString() + "\">Ok</div>");
    } catch (JSONException ex) {
        log(ex.getMessage(), ex);
        sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "<div id=\"eJSON\">Internal error.</div>");
    } catch (EntityNotFoundException ex) {
        log(ex.getMessage(), ex);
        sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "<div id=\"eEntityNotFound\">Internal error.</div>");
    } catch (NumberFormatException ex) {
        log(ex.getMessage(), ex);
        sendError(response, HttpServletResponse.SC_CONFLICT, "<div id=\"eNumberFormat\">Number error.</div>");
    }
}

From source file:cn.knet.showcase.demos.servletproxy.ProxyServlet.java

/** Copy cookie from the proxy to the servlet client.
 *  Replaces cookie path to local path and renames cookie to avoid collisions.
 *//*from  w  ww .jav  a  2 s  . co  m*/
protected void copyProxyCookie(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
        Header header) {
    List<HttpCookie> cookies = HttpCookie.parse(header.getValue());
    String path = servletRequest.getContextPath(); // path starts with / or is empty string
    path += servletRequest.getServletPath(); // servlet path starts with / or is empty string

    for (HttpCookie cookie : cookies) {
        //set cookie name prefixed w/ a proxy value so it won't collide w/ other cookies
        String proxyCookieName = getCookieNamePrefix() + cookie.getName();
        Cookie servletCookie = new Cookie(proxyCookieName, cookie.getValue());
        servletCookie.setComment(cookie.getComment());
        servletCookie.setMaxAge((int) cookie.getMaxAge());
        servletCookie.setPath(path); //set to the path of the proxy servlet
        // don't set cookie domain
        servletCookie.setSecure(cookie.getSecure());
        servletCookie.setVersion(cookie.getVersion());
        servletResponse.addCookie(servletCookie);
    }
}