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
414 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet doXXX methods 3 62
Apps blocked by Java 9 88
ejb stateless example 2 20
Java Eclipse Loop 3 20
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

840 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