Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

With request.getCookies() I do not get all cookies!

Thread view: 
Dobedani - 27 Jun 2005 12:42 GMT
Dear All,

I have written a Java Server Page and I have added this as my first
line of Java code:
Cookie cookies[] = request.getCookies();

When I loop through the cookies like this
     out.println("<table>");
     for (int i=0; i<cookies.length; i++) {
       out.println("<tr>");
       out.println("<td>" + cookies[i].getName() + "</td>");
       out.println("<td>" + cookies[i].getDomain() + "</td>");
       out.println("<td>" + cookies[i].getPath() + "</td>");
       out.println("<td>" + cookies[i].getValue() + "</td>");
       out.println("<td>" + cookies[i].getMaxAge() + "</td>");
       out.println("</tr>");
     }
     out.println("</table>");
I get all the cookies BUT ONE!

I make sure I use the same browser window throughout. I am running all
kinds of applications on my machine, e.g. some based on ASP Classic
etc. I am also runnig a CGI application developed in Delphi with an
add-on called CGI Expert. In that application a cookie is set with name
$$Default. With ASP, Perl etc. my scripts show all the (session)
cookies like JSESSIONID, ASPSESSIONXXX, incl. the one called $$Default.
However, when I run my Java Server Page, I see all those other cookies
but the $$Default cookie is not shown!!!

Unfortunately, I am interested to get hold of that very cookie! Is
there maybe a way to get hold of something that is send along in the
headers called HTTP_COOKIE? I have already tried to use a servlet and
to get this thing by invoking:
servlet.getInitParameter("HTTP_COOKIE")
to no avail. Please help! TIA

Kind regards,
Dobedani
Wageningen
The Netherlands
Anton Spaans - 28 Jun 2005 21:57 GMT
> Dear All,
>
[quoted text clipped - 36 lines]
> Wageningen
> The Netherlands

Very simple:
The official api-documentation of javax.servlet.http.Cookie specifies this
for the name of the cookie:
====================
The name must conform to RFC 2109. That means it can contain only ASCII
alphanumeric characters and cannot contain commas, semicolons, or white
space or (!)begin with a $ character(!). The cookie's name cannot be changed
after creation
====================

That means that the name "$$Default" is not valid for a cookie....
-- Anton.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.