Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.IllegalArgumentException: Cookie name "My ice cream flavour" is a reserved token  RSS feed

 
tangara goh
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I try to run an experiment on cookies.

A html form is created where there's an input value="My icre cream flavour" is submitted to a servlet to process and display the name, cookies id.

However, netbean ide is giving me the above error. If I use My_ice_crem_flavour", then the servlet can run without a hitch.

Can someone advise me how to rectify this error?

Tks & hope to hear expert advise.
 
sushil grover
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you setting the cookie with the name you specified.
if yes, you cannot use space in cookie. Please refer to below link.

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/Cookie.html
 
tangara goh
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. However, it's supposed to display the name separately - My ice creaam flavour"

Please advise how to make that work?

Thanks alot.
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tangara goh wrote:I see. However, it's supposed to display the name separately - My ice creaam flavour"

Please advise how to make that work?

Thanks alot.


Please review the link provided by tangara. The API clearly states:


java.lang.IllegalArgumentException - if the cookie name contains illegal characters (for example, a comma, space, or semicolon) or it is one of the tokens reserved for use by the cookie protocol
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!