Hi I am reading the cookies from the client machine to see whether , he has previously visited my site. currently i invoke a method request.getCookies() to get all the cookies and then loop thru them to find out whether the required cookie is there or not. Is there a method or a way to find out directly whether he has the cookies from my site. or everytime i have to loop thru all the cookies on his machine ( this takes time if he has lot of cookies). Thanx Padmanabh
request.getCookies() returns only the cookies sent with this particular request, not every cookie on the user's machine. ------------------ Phil Hanna Sun Certified Programmer for the Java 2 Platform Author of : JSP: The Complete Reference Instant Java Servlets
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
...so if you (padmanabh) do not get any cookies when you call the method getCookies(), then there are not any that you previously sent. Well, almost. The servlet API allows you to sate myCookie.setDomain("........"); That domain could be any domain. So theoretically you could send a cookie from a domain so that ANOTHER domain may read it. Unless you have Netscape 4.x (and I hope 6.x) where you can choose the option "Accept only cookies that get sent back to the originating server".
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD