Skip to content

Instantly share code, notes, and snippets.

@ThomasLocke
Created October 17, 2012 12:20
Show Gist options
  • Save ThomasLocke/3905249 to your computer and use it in GitHub Desktop.
Save ThomasLocke/3905249 to your computer and use it in GitHub Desktop.
AWS.Session test
with AWS.Session;
with AWS.Templates;
package body View.Session_Test is
---------------
-- Generate --
---------------
function Generate
(Request : in AWS.Status.Data)
return AWS.Response.Data
is
use AWS.Session;
use AWS.Templates;
Counter : Natural := 0;
Session_Id : Id;
T : Translate_Set;
begin
if AWS.Status.Has_Session (Request) then
Insert (T, Assoc ("SESSION_ENABLED", True));
Session_Id := AWS.Status.Session (Request);
Insert (T, Assoc ("HAS_SESSION_ID", True));
Insert (T, Assoc ("SESSION_ID", Image (Session_Id)));
Counter := Get (Session_Id, "counter");
Insert (T, Assoc ("SESSION_COUNTER", Counter));
Counter := Counter + 1;
Set (Session_Id, "counter", Counter);
end if;
return Build_Response
(Status_Data => Request,
Template_File => Template_Session_Test,
Translations => T);
end Generate;
end View.Session_Test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment