Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Medium Priority
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.
Question by:jwright9
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 84

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.
LVL 28

Expert Comment

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

Expert Comment

by:Dave Baldwin
ID: 36577963
I think you will find that 'httponly' can only be set, not read.  See here:
LVL 28

Accepted Solution

rrz earned 2000 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.
LVL 84

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.

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Introduction This warning has to be one of the most commonly issued warnings in the history of PHP.  The article explains why this warning arises and what to do to mitigate the problem. How this Happens HTTP headers include many different kinds…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

722 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