Play with Cookies using Scala and Lift

Reading Time: < 1 minute

As we know , Cookie is a small piece of data which is sent from a website and stored in a user’s web browser while a user is browsing a website. Next time , when user browses , cookie can be retrieved . Cookies are essentially a token of string data that is stored on the user’s machine.
In this section , I will explain how easily you can play with cookies using Lift web framework and Scala language . Lift is an expressive and elegant framework for writing web applications. Lift provides its own Cookie support (rather than using underlying Servlet cookie support) . Using Cookies in Lift is very easy.

Add Cookie :

Note: If you are trying to add a cookie with an existing cookie name , it will overwrite that cookie .
Delete Cookie :

Fetch Cookie :
If you want cookie with a given name :

If you want list of cookies , which will be sent in the response :


Written by 

Ayush is the Sr. Lead Consultant @ Knoldus Software LLP. In his 10 years of experience he has become a developer with proven experience in architecting and developing web applications. Ayush has a Masters in Computer Application from U.P. Technical University, Ayush is a strong-willed and self-motivated professional who takes deep care in adhering to quality norms within projects. He is capable of managing challenging projects with remarkable deadline sensitivity without compromising code quality.

Knoldus Pune Careers - Hiring Freshers

Get a head start on your career at Knoldus. Join us!