Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

How can I get the httponly value for a cookie and retrieve the value so that I can print it out?

How can I get the httponly value for a cookie and retrieve the value so that I can print it out?  I want to do this in a J2EE/Struts application.
0
jwright9
Asked:
jwright9
  • 3
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
When I look at cookies in the Request Header, all I see are the name/value pairs, no other info about the cookies is passed.
0
 
rrzCommented:
What server are you using ?  
In Java Servlet API 3.0   , the Cookie class has the method  isHttpOnly() .  
0
 
Dave BaldwinFixer of ProblemsCommented:
I think you will find that 'httponly' can only be set, not read.  See here: http://en.wikipedia.org/wiki/HTTP_cookie#Cookie_attributes
0
 
rrzCommented:
According to the API
public void setHttpOnly(boolean isHttpOnly)  Marks or unmarks this cookie as HttpOnly.
public boolean isHttpOnly()  Checks whether this cookie has been marked as HttpOnly.  
So, we can set it , and we can check if it has been set.
0
 
Dave BaldwinFixer of ProblemsCommented:
But you can't read it back from the browser to know how it is set in the browser.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now