2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

How to implement HTTP Only & Secure in servlet 2.5 version?

Hi,

Please Let me how to implement HttpOnly & Secure flage in servlet 2.5? Please provide an example?

userimage

If you want to implement using program probably you would like to as code as below:


response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; HttpOnly");


And if you want to do the same using configuration then you can use below way:


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


Answer is