Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
tangara goh
Ranch Hand
Posts: 126
  • 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: 126
  • 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
 
You can't expect to wield supreme executive power just because
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!