[opencms-dev] Cookies in OpenCMS again ...

Urich, Chase ChaseUrich at letu.edu
Tue May 13 23:26:01 CEST 2003


Thank you for the information, I'll expand my search ... 
Has anyone else encountered this, and if not, how are you utilizing
cookies?

Chase Urich

-----Original Message-----
From: Tim Howland [mailto:thowland at organic.com] 
Sent: Tuesday, May 13, 2003 4:00 PM
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] Cookies in OpenCMS again ...


I had a similar problem; it looks like the cookie isn't getting set in
the correct context when in opencms (I was using the response tag
library). I proved it out by examining the actual http headers as they
flew by. My code worked fine outside of the cms. I can send you a quick
and dirty perl proxy server that echoes out the headers + the bodies of
page requests as they fly by, if interested.

I came up with a workaround of using javascript to set the cookie at the
destination page- inelegant, but functional.

I'd suggest digging into the page context stuff- it looks like that's
where the response header is coming from.

Good luck,

Tim


On Tue, 13 May 2003, Urich, Chase wrote:

> I've proven that my cookie code works by running it in a different 
> webapp. Is there a reason that it doesn't work in OpenCMS? I have the 
> path set to "/" ... Is there something OpenCMS specific that I'm 
> missing? My code has been included below for reference:
>
> <!-- cookie.jsp (page 1) -->
> <%@ page import="javax.servlet.http.*" %>
> <%
> 	Cookie cookie = new Cookie ("cookieName", "cookieValue");
> 	cookie.setPath("/");
> 	cookie.setMaxAge(365 * 24 * 60 * 60);
> 	response.addCookie(cookie);
> %>
> <html><head></head><body>
> Cookie Set? ... hopefully.<br />
> <a href='cookie2.jsp'>Cookie 2 test</a>
> </body>
> </html>
>
> <!-- cookie2.jsp (page 2) -->
> <%@ page import="java.net.*"%>
> <HTML>
> <HEAD>
> </HEAD>
> <BODY><pre><%
> 	String cookieName = "Username";
> 	Cookie cookies[] = request.getCookies ();
> 	for (int i = 0; i < cookies.length; i++) {
> 		out.println(cookies[i].getName() + " -> " +
cookies[i].getValue());
> 	}
> %></pre>
> <a href='cookie.jsp'>Cookie test</a>
> </BODY>
> </HTML>
>
> Chase Urich
> Web Programmer
> LeTourneau University _______________________________________________
> 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
>



--
Tim Howland
 Engineering
 Organic
 212-822-6742
_______________________________________________
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