Re: Authenticating to servlet

From: Wendy S (wendywds_at_hotmail.com)
Date: 11/04/03


Date: Mon, 03 Nov 2003 20:54:28 -0700

Ike wrote:
> Yes.....I thought (mistakenly perhaps) that typically people assigned a
> connection object with a login. I guess not though. Perhaps I can obtain a
> session object, passing it via php or jsp as a parameter to the applet
> (ugh)......there must be an easier way?

Not me, I grab connections and throw them away as soon as I'm done with
them. Holding connections open for long periods of time isn't appealing to
me.

I don't know enough about how sessions are created and stored in Tomcat to
be able to advise, but I bet you can get the session ID and pass it to the
applet. From what I've seen, (and I have no idea if this would work,) you
might be able to tag it on the end of the URL with
;jsessionid=aldjf89623865 and Tomcat will pick that up and "know" what
session the request belongs to.

Play around with Tomcat sessions with your browser, you'll see the
jsessionid get appended to the URL on the first request (and IIRC
subsequent requests as well if you don't have cookies enabled). So the
applet could just behave like a non-cookie-enabled browser. Tomcat isn't
going to know the difference, all it sees is a request.

The applet/servlet communication I'm talking about here is over HTTP. You
can send pretty much anything over HTTP, even serialized objects. So when
you talk about passing the session id as a parameter, I would not do that.
I would have the applet connect to the server and ask, "What's my session
id?" Then it would remember that value and append it to any subsequent
requests so that the server will know what session the applet is in.

Note, however, that I've never actually written an applet. :) All my
experience is server-side.

This is still separate from the issue of connection pooling though!

-- 
Wendy in Chandler, AZ


Relevant Pages

  • 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: Per-request variables for web apps?
    ... I'd rather not refactor every single ajax call to add a user session ... When a request comes in, grab a thread, give it ... A connection is not the same thing as as session. ...
    (comp.lang.lisp)
  • Re: TOMCAT PROBLEM: Establishing a session
    ... > I have a java applet running inside the html produced by the java ... > servlet, we have written a second servlet which implements a HashTable ... Do note that where sessions are maintained via a session cookie, ... You must also take care when trying to pass request parameters ...
    (comp.lang.java.programmer)
  • Re: [PHP] How to pass connection as global variable ?
    ... This connection is set in $_SESSION to make it a global variable for all scripts. ... Postgresql & php tutorials ... However, because there is no communication between client and server unless the client makes a request you can never actually determine the _current_ status of your session, only in retrospect you can. ...
    (php.general)
  • Re: [PHP] How to pass connection as global variable ?
    ... [PHP] How to pass connection as global variable? ... The startup script default.php sets the connection once for all the scripts. ... This connection is set in $_SESSION to make it a global variable for all scripts. ... However, because there is no communication between client and server unless the client makes a request you can never actually determine the _current_ status of your session, only in retrospect you can. ...
    (php.general)