> I have received many questions about managing HTTP sessions thru the DB,
> so I thought I'd post some pseudo code(I have coded this with PHP & Java
> and it's really simple, but I can't post production code, I'm under
> contract ; ) )
>
> When I say cookie, I mean either Session cookies(the right way) or
> NonSession cookies(which will leave a cookie file in the users cache even
> after he leaves your site)
>
> to generate a session, we do this:
> Check if there's no cookie/URL parameter with our session name
> IF COOKIE
>       RETURN COOKIE
> OTHERWISE
> create a session cookie
> {
>       calculate a random int
>       get an md5 hash on the int
> } that's our session key
>
> to save a var state:
> save(key,varname,varvalue,expires)
> records into a DB row(or a file, or JNDI, or Jini, or...) the data above
> (if no key & varname combination exists, we INSERT the record... otherwise
> we UPDATE it)
> get(key,varname) it's a simple SELECT that returns the varvalue inserted
> above.
>
> A garbage collector (asynchronic) performs DELETE on expired records.
>
> If the user's browser supports cookies, that's it, if not, you must pass
> the URL parameter to each link.
> say, you have a link to another page
>       <A HREF="otherpage.htm">click to go to other page</A>
>       <A HREF="otherpage.htm?SESSIONID=<value-of-session-key>">click to go
> to other page</A>
>
> This way you can easily implement Session state persisted in the DB (and
> thus, you don't depend on WHICH web server or app server serves the
> request). This is very useful, because it allows you to configure your
> HTTP sprayer in Round-Robin mode, thus minimizing the latency of the
> actual 'spraying'....
>
> email me any questions
>
>
> -------------------------------------
> Juan Pablo Lorandi
> Programmer
> Development Area - Production Department
> [EMAIL PROTECTED]
> http://www.amtec.net
>
> Amtec.net - The eBuilder Company of LatinAmerica
> =============================================================
> Este e-mail contiene informacion que puede resultar confidencial y
> privilegiada.
> Si Ud. no es el destinatario (o no est� autorizado por el destinatario) no
> puede usar,
> copiar, reenviar o dar a conocer a nadie este mensaje o cualquier
> informaci�n
> contenida en el mismo. Si Ud. recibi� este e-mail por error, por favor
> comuniqueselo
> al remitente reenviandoselo a la direccion original (@amtec.net), y borre
> este material
> de todas las computadoras. Muchas Gracias.
>
> This e-mail contains information which may be confidential and privileged.
> Unless you are the addressee (or authorized to receive for the addressee),
> you may not use, copy or disclose to anyone the message or any information
> contained in the message.  If you have received the message in error,
> please
> advise the sender by reply e-mail @amtec.net, and delete the  material
> from any
> computer. Thank you very much.
> =============================================================
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to