Marking cookie as HTTPOnly in J2EE 5

The Cookie API in J2EE 2.5 doesn’t have a ‘setHttpOnly’ method. So I had to resort to a work around to achieve this. Instead of doing a response.addCookie, I had to write a custom method that writes the “Set-Cookie” header and use StringBuilder to construct the header value.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: