Hello all,

I have an issue I am trying to work through and hoped someone might be able
to offer some advice.

I have used the sessionTracker and getSessionCollection many times to write
what I guess you'd call a remote kill switch... basically just a way of
giving an admin or site owner the ability to see who is logged into a given
#application.applicationName# and log them out (individually).

So for instance, if I wanted to get all of the sessions in a given app, I
could just do something like:

<cfset variables.objSesT =
createObject("java","coldfusion.runtime.SessionTracker") />

<cfset variables.userSessions =
local.objSesT.getSessionCollection(application.applicationName) />

Typically, in my apps, a logged in user has a unique structure within the
session scope (which is the case here as well) so I can just loop over
variables.userSessions from above and extract logged in user info from those
structs (where they exist).

Now, my problem is that I need to add this same functionality to a web
service. The remote admin can pass in an encrypted string that contains a
UserID. The system would find the session structure that belongs to that
userID (if it exists) and clear/delete it which, in effect, would log them
out. It sounded simple enough, especially since I had done it many times.

The problem I have run into is that application scope (and thus
application.applicationName) is not available from within the webservice.

I hardcoded the application name in the webservice method just to make sure
everything else was going to work; it did and now I am just left with
resolving the issue of getting the app name dynamically.

I can't simply leave the app name hardcoded since it is generated in a
unique way per app and per customer.

I could just generate it again inside the webservice but that just feels
wrong. I guess I don't like that because it is really assuming that the
application name is going to exist. Also, if we ever change the way apps are
named, we'd have to remember to update the webservice too.

Can anyone out there think of simple (scalable) solution to this?

Maybe there is a better (or just another) way of getting at all of this info
in some underlying Java routines?

Sorry for the long explanation of a simple problem... I have a habit of
doing that. ;-)


.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342943
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to