[AWS] AWS - maintain state between server and client

Thomas Løcke thomas.granvej6 at gmail.com
Thu Apr 8 21:16:03 CEST 2010


On Thu, Apr 8, 2010 at 4:31 PM, Pascal Obry <pascal at obry.net> wrote:
> This is not directly supported by AWS. You could either add an expiration date
> to the cookie (see AWS.Server.HTTP_Utils.Send_General_Header) or
> send your own cookie for this.

I found this in the v2p software:

Set_Cookie :
declare
   use type Ada.Calendar.Arithmetic.Day_Count;
   Valid_Days : constant Ada.Calendar.Arithmetic.Day_Count := 15;
   HTTP_Date  : constant String :=  AWS.Messages.To_HTTP_Date
     (Ada.Calendar.Clock + Valid_Days);
   GenCookie  : constant String := Database.Gen_Cookie
     (Session.Get (SID, Template_Defs.Set_Global.LOGIN));
begin
   AWS.Response.Set.Add_Header
     (Web_Page,
     AWS.Messages.Set_Cookie_Token,
     Value => "v2p=" & GenCookie & "; expires=" & HTTP_Date & "; path=/");
   Context.Set_Value ("cookie", "set");
end Set_Cookie;

This appears to do what I need in terms of setting the cookie. Now I
just need to figure out how to read it again.

Am I on the right track?  :o)

Thomas Løcke


More information about the AWS mailing list