Specifically, I want to look up what parameters the constructor of the Cookie class takes.

The most official looking thing I could find was in the salesforce developers docs, but the constructor is not documented there.

Is there one canonical place to go for this sort of information?

Also, I don't have enough rep to create a more suitable tag for this question. Something like "tools". Can someone please re-tag this more appropriately?


You should be able to find all the documentation you need here:


Specifically, Apex docs are here:


  • OK, so what you are saying is, I was at the right place, but the official reference is not complete, right? The first link has great docs, but it is not a systematic language/class reference and I can't find what I was looking for in any of the two places or anywhere on the web for that matter. – JannieT Nov 29 '12 at 8:12
  • Have you checked the reference section of the second link for what you need? – Phil Hawthorn Nov 29 '12 at 8:17
  • Phil, have you seen the link in my question? I did try very hard before posting here. – JannieT Nov 29 '12 at 8:25
  • Doh, sorry - for some reason I didn't see/notice that before. I think you're first comment is probably correct, i.e. i doubt you'll find anything more official. The documentation implies the constructor arguments name, content, path 'null', maxAge '-1', and isSecure 'false'. My guess would be that its just a wrapper for the Cookie Java class docs.oracle.com/javaee/1.4/api/javax/servlet/http/Cookie.html – Phil Hawthorn Nov 29 '12 at 8:54
  • OK, thanks! I'll ask a separate question about the specifics of the constructor. – JannieT Nov 29 '12 at 8:58

You are looking in the correct place, but its one of those areas that isn't well documented, presumably because it doesn't get used that much and nobody has reported the problem.

I have used cookies in the past, and struggled in the same way that you did. My understanding of the constructor is as follows:

Cookie cook=new Cookie('Name', 'Keir Bowden', null, 1440, false);


  • 'Name' = the name of the cookie
  • 'Keir Bowden' = the value of the cookie
  • null = the cookie path (where null results in the default location '/')
  • 1440 = the max age
  • false = is the cookie only accessible through https

This is only my opinion though! I also recall that the max age didn't seem to have any effect, and I could only generate session cookies, but in the end I couldn't do what I wanted to anyway so I didn't investigate further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.