File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes cookie question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "cookie question" Watch "cookie question" New topic
Author

cookie question

Stan dmello
Greenhorn

Joined: Jul 03, 2005
Posts: 1
Hi,

I was wondering if we can set the cookie for the domain other than our own domain.

I mean, if our domain is abc.com then can we use setDomain(".xyz.com")
to set cookie for xyz.com?

Thanks,

-Stan
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

Some searching from google reveals the answer:

"Normally, the browser returns cookies only to the same hostname that sent them. You can use setDomain method to instruct the browser to return them to other hosts within the same domain. To prevent servers from setting cookies that apply to hosts outside their domain, the specified domain must meet the following two requirements: It must start with a dot (e.g., .prenhall.com); it must contain two dots for noncountry domains like .com, .edu, and .gov; and it must contain three dots for country domains like .co.uk and .edu.es."


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cookie question
 
Similar Threads
Cookies access between sub domains
Multiple JSESSIONID cookies getting created
Using spring security across multiple apps
Apache Web Server mapping of URL to index page of the Application
Cookies across multiple domains