stephenjbell

Set cookie with path and domain - dotCMS

Aug 30th, 2011
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ###### Set a dotCMS cookie with path and domain
  2.  
  3. ## The normal dotCMS cookie tool doesn't let you specify options :(
  4. ## http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/view/CookieTool.html
  5. $cookietool.add("testcookie",'lumberjack')
  6.  
  7. ##-------------------------------------
  8.  
  9. ## Setting a cookie in the header is more flexible :)
  10. $response.setHeader("Set-Cookie","testcookie=lumberjack;expires=Sat, 01-Jan-2012 00:00:00 GMT;path=/;domain=oc.edu")
  11.  
  12. ## Get the cookie value
  13. $cookietool.testcookie.value
  14.  
  15.  
  16. ##-------------------------------------
  17. ## Created by mashing up these things:
  18. ## http://learndotcms.com/2009/09/creating-an-ical-feed-from-dotcms-contentcalendar/
  19. ## http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
  20. ## http://msdn.microsoft.com/en-us/library/aa384321(v=vs.85).aspx
Advertisement
Add Comment
Please, Sign In to add comment