Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7429771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:01:40+00:00 2026-05-29T09:01:40+00:00

In Servlet 3.0 complaint application servers I can set the HttpOnly and secure flags

  • 0

In Servlet 3.0 complaint application servers I can set the HttpOnly and secure flags for the session cookie (JSESSIONID) by adding the following to the web.xml:

<session-config>
  <cookie-config>
    <secure>true</secure>
    <http-only>true</http-only>
  </cookie-config>
</session-config>

However, the application I’m working on is to be deployed in Websphere 7, which is Servlet 2.5 complaint and it fails to start if I add the above to the web.xml

Is there any other declarative way or setting in Websphere 7 configuration to turn on the HttpOnly and secure flags for the session cookie?

If not, what would be the best approach to accomplish that programmatically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:01:41+00:00Added an answer on May 29, 2026 at 9:01 am

    I think in WebSphere 7 you may have to delve into the administrative console. As ever the WebSphere documentation seems poor but seems to suggest setting the com.ibm.ws.security.addHttpOnlyAttributeToCookies property:

    Both the Secure flag and the HTTPOnly flag are enabled by setting the WebSphere Application Server property:
    com.ibm.ws.security.addHttpOnlyAttributeToCookies.

    I found this, which I hope is applicable to WAS7. Can you try please (I only have WAS 8 at the moment on my system):

    JSESSIONID cookie:

    Secure Flag:

    The Secure flag can be set within the WebSphere Application Server
    administrative interface by selecting AppServer->[Server Name]->Web
    Container Settings->Session Management. Check the checkbox for
    “Restrict cookies to HTTPS Sessions”.

    HTTPOnly Flag:

    The HTTPOnly attribute cannot currently be set on this cookie. This
    is registered on the IBM site as APAR PK98436. The fix for this APAR
    is currently targeted for inclusion in Fix Packs 6.1.0.31 and 7.0.0.9,
    which are not yet available. With this APAR in place, the HTTPOnly
    flag can be set on the JSESSIONID cookie by way of the property name:
    com.ibm.ws.webcontainer.httpOnlyCookies. Refer to the following
    technote for instructions on enabling WebContainer custom properties.

    The com.ibm.ws.webcontainer.httpOnlyCookies property is documented on the WAS 7 help site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Servlet, I can do the following to process binary stream: public void doPost(HttpServletRequest
Servlet context is per application (or per .WAR). Is there anything that attributes can
Servlet API provides a convenient way to set cookies: response.addCookie(new Cookie(name, value)) JavaDoc tells:
Based on Java Servlet Specification Version 3.0 : In the Web application deployment descriptor,
My servlet application includes a number of library .jars, some of which contain embedded
My servlet-based web-app sometimes fails to close Log4j log files when redeployed, leaking to
We have a web application running in a production enviroment and at some point
I have the following problem. I programmed a java servlet, which responses to ajax
Servlet Configuration in web.xml <servlet> <description>This is the description of my J2EE component</description> <display-name>This
in servlet, as we can access the real path of deployed project ServletContext context

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.