[opencms-dev] setting cookies in OpenCms doesn't work.

Stephan Hartmann beffe at beffe.de
Fri Sep 17 20:12:44 CEST 2004


If you are talking about OpenCms version 5.0 or 5.0.1, this is a bug.
Here is  a workaround (cmso is a CmsObject):

((HttpServletResponse)cmso.getRequestContext().getResponse().getOriginalResp
onse()).addCookie(cookie);

Bye,
Stephan
----- Original Message -----
From: "Millo Magnocavallo" <millo_magno at yahoo.com>
To: <opencms-dev at opencms.org>
Sent: Friday, September 17, 2004 6:56 PM
Subject: [opencms-dev] setting cookies in OpenCms doesn't work.


> Hi,
>
> Can anyone tell me why I can't set cookies in OpenCms? Do I need to
> have something turned on, is there a special configuration change I
> have to make? This is the following code which i've tested and works
> fine in a tomcat jsp environment yet doesn't work in OpenCms:
>
> <html>
> <body>
> <head><title>setting cookies</title></head>
> <%
> Cookie cookie = new Cookie("autoLogin","true");
> cookie.setMaxAge(2147483647);
> response.addCookie(cookie);
>
> Cookie[] cookies = request.getCookies();
> out.print("<br>cookies.length = " + cookies.length + "<br>");
> if (cookies != null) {
> for (int i=0; i < cookies.length; i++) {
> out.print("<br>cookie" + i + " name:" + cookies[i].getName());
> out.print("<br>cookie" + i + " value:" + cookies[i].getValue());
> }
> }
> %>
> </body>
> </html>
>
> Your help appreciated,
> M
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>




More information about the opencms-dev mailing list