07/08/2008

HttpSession: http session variables in LotusScript

Unfortunately I could not find anything already developed... ;-)

I'm developing HttpSession, a class hosted by a LS library, to manage HTTP sessions variables shared among many LS web agents calls.
Right now the library is in alpha stage, I'm continuing testing it... ;)
HttpSession
Http session variables are commonly used in Java servlets.
I decided to mimic somehow the HttpSession interface as defined in Java.
In small words, just using HttpSession during web development, when a web user invokes LS agentA and LS agentB, the programmer can save, "on the server" (ticket Notes db), some useful variables that don't need to be "moved" around using URL rewriting or posting hidden form fields.
Session variables scope is for a specific web user and the life of those session variables is preserved until the browser session ends (either the web browser is closed or the programmer decide to end the session programmatically).
Web users calling web agents do not need to be authenticated, even anonymous web users can invoke web agents.
The web user session is built using session cookies, that will expired automatically closing the browser.
Here's some example code that use HttpSession class, just to give a basic idea of its usage.
Stay tuned! ;)
AgentA code snippet:
Dim hs As HttpSession

Sub Initialize

Set hs= New HttpSession("")
Print "Content-type: text/html"
Print hs.getCookieHttpHeader()
Print

' your code...
Call hs.setAttribute("myname", "hello world!" )

AgentB code snippet:

Dim hs As HttpSession
Sub Initialize

dim myvar as String
Set hs= New HttpSession("")
Print "Content-type: text/html"
Print hs.getCookieHttpHeader()
Print
' your code...
myvar= hs.getAttribute("myname" )
print "here is myvar= " & myvar

4 comments:

tuopoj said...

penso ce ne siano già varie in giro. non so se hai bisogno di funzioni particolari.

Cristian D'Aloisio said...

Davvero? Io in giro non ho trovato nessuna classe specifica per LotusScript :(

Oltre alle ricerche sul web, ho scritto anche un post di richeste info alla comunità...

Ma se sei a conoscenza di info fresche, ti chiedo di mettere un link al materiale di cui sei a conoscenza.

Ciao

Jake Howlett said...

An interesting concept. I'll be watching how you get on with interest.
If I remember to I'll mention it on codestore at some point and see if I can you some other people interested in it who can help out.

Jake

Cristian D'Aloisio said...

Hi Jake,
I'm glad you're interested in the Http Session variables subject.

I'm sure my class can be improved a lot by the all community: for me that's just a start.

Anyway, keep on the good work on your codestore blog, it rocks!