This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, How can we know if cookies are enabled via just the request object we have. I know the way via which we can, - write a cookie - read it back and if we do get value it means cookies are enabled BUT I want to know if there is anyway I can know this information w/o doing these two steps. The reason is, I thought I would write a CookieManager class to add,delete,parse cookies...Now that class would be a stand alone object used in Servlet/JSPs to which I plan to pass a request object and want to have a method in there that says "ifCookiesEnabled()"...you know... I am not very optimistic about the answer here but I am throwing question... Nor I am sure how much worth this CookieManager would be... Thanks! Maulin
Hi, You already gave the right answer to you own question; that's the way to check cookie-awareness of the client. There is no method in the HttpServletRequest to check for cookie-awareness (not even in J2EE 1.4). Enabling this would require all browsers to support such a query ("Do you support cookies Y/N?") from the server. Anyway, your solution will do the trick anyway