i need to set cookies on the client machine say for example in C:\Documents and Settings\users\Cookies. how do i do it with the help of servlets. can anyone please guide me. iam completely lost. thanks in advance.
public String getPath() public void setPath(String path)
These methods get or set the path to which the cookie applies. If you don�t specify a path, the browser returns the cookie only to URLs in or below the directory containing the page that sent the cookie. For example, if the server sent the cookie from http://ecommerce.site.com/toys/specials.html, the browser would send the cookie back when connecting to http://ecommerce.site.com/toys/bikes/beginners.html, but not to http://ecommerce.site.com/cds/classical.html. The setPath method can be used to specify something more general. For example, someCookie.setPath("/") specifies that all pages on the server should receive the cookie. The path specified must include the current page; that is, you may specify a more general path than the default, but not a more specific one. So, for example, a servlet at http://host/store/cust-service/request could specify a path of /store/ (since /store/ includes /store/cust-service/) but not a path of /store/cust-service/returns/ (since this directory does not include /store/cust-service/).
i need to set cookies on the client machine say for example in C:\Documents and Settings\users\Cookies. how do i do it with the help of servlets. can anyone please guide me. iam completely lost. thanks in advance.
I do not think that we can specify the location where the cookie need to be saved.Using servlet api you can create cookie and send to client , but again you cannot specify any location.
In addition to what Rahul said, cookies are browser-specific, and each browser stores cookies in a different location. The web app has no control over that.
The setPath method mentioned above refers to server paths, not client paths.
Amit, There are diff diff root folder for each user of the system, so there will be separate 'cookie' folder creadted inside root folder of each user, so in these cookie folder there will be index.dat file. so all cookie information will be stored in this file.