Re: Per-request variables for web apps?



Jonathon McKitrick wrote:
Here is my issue. I'm running Araneida on SBCL/Linux. When a user is
connected, I need to maintain a couple of globals, if possible,
attached to that user session. Almost all of the logic is implemented
with ajax, making cl-ajax calls to the server.

I'd rather not refactor every single ajax call to add a user session
id, but I will if I have to. Is that the best way? Is there a way to

I would say that the appropriate scope for binding threads in a web
service is the request. When a request comes in, grab a thread, give it
the context for that request, and let it handle it. When the request is
done, the thread is put back in the pool.

A connection is not the same thing as as session. A session is a set of
requests, which don't necessarily use the same connection. A browser
can close and re-open its TCP socket at any time. Moreover, browsing
can go through a proxy, which can close its connection (for instance by
being rebooted).

So associating sessions with connections is a very bad idea. It might
work for some tiny application that runs as a process on the user's
machine, with a browser connecting to http://127.0.0.1/. But in such a
thing you can just use global variables anyway.

just spin off a new thread for each connection? Are cookies a better
way?

Not really, because you have to keep requesting the cookie whenever you
need the data. A request comes in and you don't know the session.

If there is some session ID that you need in every request to every
URL, what you do is you smuggle that in the requests themselves.
Whenever you generate a page in the context of a session, you ensure
that all of the elements in that page which are played back to your
server (hyperlinks and forms!) contain the session ID. That way it is
handed to the next request, and so on. Each URL you generate has the ID
embedded. When it comes to forms, you can also embed it in the action
URL, or you can seed the value of an invisible field.

.



Relevant Pages

  • Re: APPN Connection z/os - AHHC / LLC2.
    ... implied that you session stopped for a while and then continued. ... the ANNC link is a type 2.1 connection. ... I would suggest trying to limit the request unit size used over the type 2.1 ... MAXDATA operand when defining a PU statement for an adjacent link station ...
    (bit.listserv.ibm-main)
  • Re: Remote desktop deadlock on XP SP2
    ... the TS connection is frozen, even if I specify a wait timeout. ... TermSrv.dll creates a new session for the purpose of displaying the logon ... lives on a DPC routine for the network miniport ... the network packets are encapsulated and decapsulated in UDP. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: JES-APPL
    ... Then there has been a session initiation request - which can only happen over an available session path - this isn't any of your flaky IP, ... Unless the NJE application on the AS/400 has consistently been caught in the middle of being activated in some way - highly unlikely I would expect - this is not a timing problem. ... Since the connection is necessarily in place, there is no problem with the connection - just in case a modem is involved - which, given a "switched" definition is used, is not impossible, but unlikely. ...
    (bit.listserv.ibm-main)
  • Re: os users, sessions, and connections.
    ... From what I've read a session is a logged connection. ... do the following (paddr is the address of the process ... select sid, serial#, paddr, username from v$session ...
    (comp.databases.oracle.server)
  • Re: Some outstanding ASP .NET questions
    ... Typically, we store the connection in the ... Session and use a Singleton pattern to retrieve it back later: ... Is it appropriate to store table key information in the session? ... I was referring to primary keys in database tables. ...
    (microsoft.public.dotnet.languages.csharp)