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 Accessing Cookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Accessing Cookie" Watch "Accessing Cookie" New topic
Author

Accessing Cookie

G Vigna
Greenhorn

Joined: Jun 01, 2005
Posts: 11
Hai,

I have a web site that is developed using different technologies (php and java servlets)

The login page is in php and the user info is stored in a cookie. There is a link in the php home page for servlet access.

When I try to view the cookies using request.getKookies(), I do not get the php cookie set. Very rarely the cookie is accessible.

Can any one help in solving this problem.

Thx,
Vigna
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
Do the PHP and the Servlet side use the same domain?

Cookies are visible to the domain they were set with, you might check that.
G Vigna
Greenhorn

Joined: Jun 01, 2005
Posts: 11
Both belong to the same domain. Php runs in apache server and the servlet in tomcat that is accessed via apache server using connector
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
Hmmmm,

check the Http Headers you get maybe the header information
is lost on the way through the connector.

HttpServletRequest.getHeadernames() &
HttpServletRequest.getHeaders
G Vigna
Greenhorn

Joined: Jun 01, 2005
Posts: 11
Now when I try to print the header information. I get the cookie but the value differs.

when printed using php it is APPSESSID= 6a8590cade7dde74997147a0eebb2778

Header cookie = JSESSIONID=4098D905AA7962BD04B0F9BB0BB3BCEA; APPSESSID=660b104c91eb2702bb1a062d65098a27

Some times only JSESSIONID gets printed. Can you please tell what would be problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing Cookie