You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/11/15 14:19:26 UTC

DO NOT REPLY [Bug 16474] - Unable to obtain correct data for version, path, or domain information from Cookie

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=16474>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=16474


Steffen.Spahr@oeffentliche.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Additional Comments From Steffen.Spahr@oeffentliche.de  2006-11-15 05:19 -------
Hi,

I am using Apache Tomcat/5.5.17.

With this version I got the same result as described in the bug-report.

Is it realy fixed?

The Cookie.getPath() and Cookie.getDomain() returns always 'null'.


My example program:

package test;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CookieAnzeige extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// Returns a writer to write to the browser
		PrintWriter out = response.getWriter();

		// Writes the string to the browser.
		out.println("Anzeige und Setzen von Cookies:");

		Cookie[] cookies = request.getCookies();
		if (cookies == null)
			out.println("Kein Cookie gesetzt!");
		else {
			for (int i = 0; i < cookies.length; i++) {
				String cookieName = cookies[i].getName();
				out.println("Cookie " + cookieName + " hat den Wert "
						+ cookies[i].getValue() + " Pfad: "
						+ cookies[i].getPath() + " Domain: "
						+ cookies[i].getDomain());
			}
		}

		Cookie Versicherungsnehmer = new Cookie("Versicherungsnehmer", "123456");
		Versicherungsnehmer.setPath("/");
		response.addCookie(Versicherungsnehmer);

		out.close();
	}
}


The result:

Anzeige und Setzen von Cookies:

Cookie JSESSIONID hat den Wert A08AE263E7D9854C649BEA65CDE5056A Pfad: null
Domain: null

Cookie Versicherungsnehmer hat den Wert 123456 Pfad: null Domain: null 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org