Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Cookie

 
G Vigna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic