tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dunkle, Ed" <Ed.Dun...@ameriserve.com>
Subject No application cookies are getting sent to browser
Date Thu, 04 May 2000 19:09:36 GMT
Is there some configuration setting to activate application level cookies?

I have servlet code that works in WebSphere (and I believe it used to work
in Apache/JServ but we don't use that anymore) for writing cookies.  Under
Tomcat (with IIS if that matters) I get a JSession cookie but it doesn't
even try to send my application cookies.

Any ideas?


Here's the code:

public void writeCookies(HttpServletResponse response, String userName,
String registrationNumber, Date expiryDate) {
	Calendar expiry = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	expiry.setTime(expiryDate);
	DateFormat df = DateFormat.getDateTimeInstance();
	SimpleDateFormat sdf = null;
	String cookieDate = null;
		
	try {
		sdf = (SimpleDateFormat) df;
		sdf.setCalendar(expiry);
		sdf.applyPattern("EEE, dd-MMM-yyyy hh:mm:ss zzz");
		cookieDate = sdf.format(expiry.getTime());
	} catch (ClassCastException cce) {
		cce.printStackTrace();
	}
	
	response.setContentType("text/html\nSet-Cookie: hot.name=" +
userName + "; path=/; expires=" + cookieDate + "\nSet-Cookie: hot.regnum=" +
registrationNumber + "; path=/; expires=" + cookieDate);
}

Mime
View raw message