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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse package explorer vs project explorer view 2 132
even odd program using while loop 3 40
jdbc error in jsp application 20 45
What's wrong with this code? 4 23
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

777 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