Solved

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

Posted on 2011-09-21
5
412 Views
Last Modified: 2012-08-14
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
Comment
Question by:jwright9
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36577572
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
 
LVL 27

Expert Comment

by:rrz
ID: 36577895
What server are you using ?  
In Java Servlet API 3.0   , the Cookie class has the method  isHttpOnly() .  
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36577963
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
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 36578072
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
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36578464
But you can't read it back from the browser to know how it is set in the browser.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now