How can I use active user session that's in an application scope Hashtable?

First of all, is it possible to use the same session after a user exits and then returns?
Second, if it is possible, then please tell me what I need to do. So far, this is what I have been doing...
1.) The user submits login credentials
2.) The user is authenticated.
3.) The user does not have an existing session, so a new one is created.
4.) The user closes the browser.
5.) The user returns to login page and submits login credentials.
6.) The user is authenticated.
7.) The user has an existing session, so it should be used.
This is where I'm having trouble. All active sessions for my application are stored in a Hashtable. I have been using <%@ page session="false" %> so that a new session is not automatically created. Each time before I create a new session, I check my Hashtable to see if that user has an existing session. If a session exists for that user, then I would like to continue using that session if possible. I have used the methods request.getSession() and request.getSession(false), but a new session is always returned.
I could create a new session, copy the attributes from the old session(which is stored in my Hashtable) to the new session, and then invalidate the old session, but I'd rather not do that.
Is there a way that I can use existing sessions that I have stored in my Hashtable?

First of all, is it possible to use the same session after a user exits and then returns?No, I don't think so. Let me explain why. When the server creates a session object for each client, it needs to know which client is making the request. Remember that HTTP is a stateless protocol. Every time a client makes a request, it sends some sort of session id to the server to let the server know who is trying to make the request. The server will then check to see if a session object exists for that particular client and if so, it will make sure that the max inactive interval (maximum time alloted for that client's session) has not been exceeded. If every thing is okay, then the client can access the session object to get values that were previously placed there. There are many ways that servers try to keep track of clients. One way is to have the clients write the session ID using cookies. But, many people like disallow cookies. So some servers do what is known as URL rewriting. That is, they will write the session ID on the end of the query string. This can also be accomplished programmatically, but it can be taxing to do. Anways, the point is that the client and the server have to have some sort of link between each other and that link is the session ID. So, if the browser is closed, the session ID is lost. That particular client will be forced to get a new session ID the next time the following code is executed:
//create a session object and set its values
HttpSession session = request.getSession(true);>
Second, if it is possible, then please tell me what I
need to do. So far, this is what I have been doing...
1.) The user submits login credentials
2.) The user is authenticated.
3.) The user does not have an existing session, so a
new one is created.
4.) The user closes the browser.
5.) The user returns to login page and submits login
credentials.
6.) The user is authenticated.
7.) The user has an existing session, so it should
be used.If you really want to do something like this, you could make up your own ID and store it as a cookie on the client. I've never tried anything like this before so you would have to do your own research. Are you sure you want to do something like this. There is a reason why it works the way it does. There is also a reason why you want to keep the session timeout value some what small. Let me give you an example of some craziness with sessions. A client we once had wanted to keep their sessions open for 4 hours because they said there clients simply did not like to log in all the time. I nearly gasped when I was told we needed to do this. When you make the session time out large (i.e. the maxInactiveInterval( )), then session objects stick around longer in the server. Let's say a client logs into the server and receives a session object. Then, the client makes a few requests. The server knows to keep the session alive as long as the time between requests has not exceeded 4 hours. Then the client closes the browser. How is the server suppose to know that the browser was closed. Well, it doesn't. It just knows to check times between requests. So, that particular session object won't be garbage collected until the session times out. What if a whole bunch of clients did this. Yucko. The server would have a whole bunch of session objects living in memory. What a waste. This is all above and beyond the typical security problems that can arise from having a session open for so long. To make a long story short, you really shouldn't do what you are trying to do unless it is the nature of the app.
>
This is where I'm having trouble. All active sessions
for my application are stored in a Hashtable. I have
been using <%@ page session="false" %> so that a new
session is not automatically created. Each time
before I create a new session, I check my Hashtable
to see if that user has an existing session. If a
session exists for that user, then I would like to
continue using that session if possible. I have used
the methods request.getSession() and
request.getSession(false), but a new session is
always returned.
I could create a new session, copy the attributes from
the old session(which is stored in my Hashtable) to
the new session, and then invalidate the old session,
but I'd rather not do that.
Is there a way that I can use existing sessions that I
have stored in my Hashtable?

Similar Messages

  • How can I use the same session for different components acroos application ?

    I am trying to include the components(chat, filesharing, whitboard) in different parts of my application. User should be able to access any of the component. We would like to have a single "ConnectSessionContainer" so that we don't see same user creating a seperate session for each component.
    Is there a better way of dealing with this other than declaring the "ConnectSessionContainer" in the main application ? Is there a way to check if we have a "ConnectSessionContainer" session already established ? Please help . Thanks.

    Thanks for the response. Let me explain what I am trying to do..
    I am trying to create components at different places(screens) of the flex application (not in the same .mxml file).
    Each time I create a component, I am using a "AdobeHSAuthenticator" and "ConnectSessionContainer" which is resulting a new participant in the room.
    For example
    screen1.mxml -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:Roster id="myRoster" width="100%" height="100%" />
            <rtc:Chat id="mychat" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    screen2.mxml (in the same application) -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:SharedWhiteBoard id="wb" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    Here, I open a screen1 and authenticate as UserA and when I try to open screen2 flex is considering me as another user though I am in the same application.
    1) How can I use different components which are in different flex files as a same User ?
    2) Should I place my <rtc:AdobeHSAuthenticator> and <rtc:ConnectSessionContainer> in the main application which calls the screen.mxml?
    3) What is the best way to do it ?
    Thanks for your time !

  • How can I use TopLink for querys that have two and more tables?

    I use TopLink today, and I can use one table to query, but how can I use TopLink for querys that have two and more tables?
    Thank you for see and answer this question.

    You can write a custom SQL query and map it to an object as needed. You can also use the Toplink query language "anyOf" or "get" commands to map two tables as long as you map them as one to one (get command) or one to many (anyOf command) in the toplink mapping workbench.
    Zev.
    check out oracle.toplink.expressions.Expression in the 10.1.3 API

  • How can i use exisitng user data(Id, password) for user mapping

    Hi All,
    For User mapping , we can import user mapping data for many users from user administration. and for each user
    we can maintain mapping data in the standard format.
    eg:
    [User]
    uid=user2
    $usermapping$:BCE:user=ext_user2
    $usermapping$:BCE:mappedpassword=password
    i am clear till this point.
    this all works if we know the userid and passowrd on the system 'BCE'.the passwords on the system 'BCE', are encrypted . so there is no chance for me to know the passwords.
    so how can i use the existed userid/passowrd on the system 'BCE' for the mapped user and mapped password on the portal while doing usermapping.
    Thanks in Advance,
    Lakshmi

    Hi,
    I think this should work.
    1. Setup SSO with SAP logon tickets first. How to do this is described many places, e.g. http://help.sap.com/saphelp_nw04/helpdata/en/d3/41c8ecb31d11d5993800508b6b8b11/content.htm
    This SSO will not work at first, because the username is different in the back-end system. So what you need to do is to get the back-end username into the ticket (don't need a password because that is done by the SAP logon ticket)
    2. Create a portal component which uses the usermanagement API to create a usermapping which only consists of the username and a blank password. You can do this manually I think if you have no reference system defined.
    IUserMappingService umap =(IUserMappingService)PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
    //this is the currently logged in user. You might another user
    IUserContext user = request.getUser();
    //Get the existing data (think it can be null)
    IUserMappingData userMapping=umap.getMappingData(systemAlias, user);
    HashMap map = new HashMap();
                             map.put(IUserMappingService.UMAP_KEY_USER, backEndUserName);
    //add blank password               map.put(IUserMappingService.UMAP_KEY_PASSWORD, "");
    //store the values                    userMapping.storeLogonData(map);
    Voila, this should allow you to do SSO using SAP logon tickets, but with another name that you use against the portal. I am uncertain if this will work if you have multiple usermappings in the sap logon ticket
    PS since the sap logon ticket is issued at logon time, you need to relogon to get the changes done by the code
    Regards
    Dagfinn

  • My iphone 4 button doesn't work. How can I use my phone without that working button?

    my iphone 4 button doesn't work. How can i use my iphone without the working button?

    Well if you restore your iPad that might work. If its a software issue, it might solve it. If that doesn't work, it might be a hardware issue that apple can fix.

  • How can I use my Iphone 5s that was purchased in the US here in the Philippines?

    please let me know

    What do you mean how can you use the phone?  Go out and buy a sim card and put it in the phone to activate it and start using it.

  • How can I use my iPhone 5s that I purchased online

    HHow can I use my iPhone 5s that is locked with someone else's iTunes account?

    If you're able to contact the previous owner, send them this link and tell them to follow its instructions.
    If not, you can't activate the device but may be able to get it refunded.
    Apple won't remove the lock for anyone other than the original owner(assuming they're alive.)
    (112269)

  • How can I delete a user group that my computer will not delete?

    I tried to remove a user group from my desktop following the procedures given. I could remove all but one user.
    This is the one I want to remove. How can I do this? I have 4 user groups. Why?, when ever I had trouble and called AppleCare
    they had me install a new user group, which I never removed.

    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Terminal in the page that opens.
    Drag or copy — do not type — the following line into the Terminal window, then press return:
    dscl . -read /groups/admin GroupMembership
    You should get the following output below what you entered:
    GroupMembership: root admin1 admin2 ...
    where admin1, admin2, ... are the names of the admin users. Is the output what you expect?

  • How can I use Active Print on my Ipad and print to my usb connected HP officejet 6110 all in one

    I was previously able to use Active Print on my Ipod to print to my usb connected HP officejet 6110 all in one.  Now, however, with my Ipad version 2 I can no longer get this to work.  Can anyone help?  Thanks.

    Hi,
    HP do not provide any USB connection solution for iOS.
    As Active Print is a 3rd party application which provide this functionality, i believe you may find a better help within Active Print support as they more familier with their application requirement and functionality:
    http://www.activeprint.net/support/
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How can I use gift card balance that is on one account, on another account?

    I have 2 iTunes accounts.  I have money on one of the email accounts, but most of my apps are under the other email account , so I can't use my gift card money on my apps.  How do I combine these, or how am I able to use my gift card balance on the other account?

    Sherriebarker wrote:
    I have 2 iTunes accounts.  ... How do I combine these,
    Sorry... you cannot.
    Sherriebarker wrote:
    how am I able to use my gift card balance on the other account?
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • How can i use the dbms_lob.session

    hi
    i need to use the dbms_lob.session in my procedure but it didn't work in the client_side (in the form side )
    and i use this procedure in the database side but when i call it from the form it will giv me an error because this package(dbms_lob.session)
    any one have an answer
    10x

    Hi,
    In order for you to be able to load the sample project into the session console you need to do the following:
    1) Start HSQL
    2) Run successfully the demo in "D:\toplink903\examples\core\examples\sessions\threetier"
    3) Add to the file "sessionconsole.cmd" the above classes location.
    It should look something like this " set CP=%TL_HOME%\core\lib\toplink.jar;%TL_HOME%\workbench\demos\democlasses.zip;%TL_HOME%\core\lib\xerces.jar;%TL_HOME%\hsql\lib\hsqldb.jar;D:\toplink903\examples\core\examples\sessions\threetier\stage;%CLASSPATH%; " Please note the ...threetier\stage
    4) Open the sessionconsole -> log into the DB -> and load the project "employeeProject.xml". You should be able to find the xml project file in "D:\toplink903\examples\core\examples\sessions\threetier"
    Raanan.

  • How can I use the CFDAQ6004.dll in a embedded c++-application?

    Hi,
    I´m working on a reaserch project and I´m trying to write a embedded c++-aplication which reads from values the Compactflash Card CFDAQ6004 of NI. Can I use the cfdaq6004.dll to read from? If yes, how to?
    I hope anyone has a solution for me
    Best regards, Homi!

    Hi there,
    I know this post is very old but i guess many guys visit it when reading the topic or by googling about CFDAQ6004 driver. Unfortunately CFDAQ6004.dll is very low level driver that support several functions dealing directly with CF6004 card such as ATTset and ATTget... etc. as one can view in any PE explorer for Windows CE. After a month of testing and analysis, i have successfully write a dll based on CFDAQ6004.dll to open, configure, read, write analog/digital data from/to CF6004 card. The new library was given a name CF6004LIB.dll the following is comparison between my dll and daqmxbase driver:
            New Dll                                                                                     DAQmxbase driver
    1. Can be used inside any programming environment                        Can only be used inside Labview
        inc. eVC++ , VC++ .net, VC# .net, VB .net
    2. Support fully dynamic task configuration                                       Only static configration possible (dynamic task can be done with modified VIs)
    3. Remove a lot of overhead by accessing CF6004 directly                Puts a lot of overhead passing through GUI, objects, controls, ...etc.
    4. Support full error detection                                                           Some errors can not be catched
    5. Full sampling rate can be achieved 200 kS/sec                               system dependent (max. 130 kS/sec in hp ipaq 211 PDA)
    6. Support contiuous/limited sampling                                               continuous sampling is possible but at reduced rate`
    7. small in size < 10 kB                                                                    Minimum program size 600 kB
    Also, I have written some modified VIs for CF6004 including reduced (specifically used for CF6004 card ) VIs and dynamic task configrable VIs.
    Bye
    Jaf

  • How can i change the user name that i have --lion.

    hi all,
    i was wondering how to change my username.  the one im referring to is the one that comes under the library icon. it is also the one that shows up under user when i launch my activity monitor application. 
    this is seemingly a different username that i use when i log onto my computer or verify changes.

    There should be something called "System Preferences" and then "accounts" go to that. There you can change it.

  • How can we use two user certificates at a time?

    Hi,
    I want to use two different user certificates for two different trading partners. Can we keep two private keys in single wallet and use those simultaneously? In our case our two trading partners are using different CA's certificate and we are forced to use two private keys.
    Please tell me that is there any way by which I can manage two private keys at a time in single wallet?
    Please help.
    Thanks & Regards,
    Anuj Dwivedi

    a. How To Extract A Private Key and Certificate From A Wallet
    Oracle does not provide any functionality within Wallet Manager, or otherwise, to do this. However this can be achieved using OpenSSL.
    - If a Linux server is available, OpenSSL is usually installed by default (/usr/bin/openssl). If not you can download it from www.openssl.org
    - To extract the key and certificate from the Wallet run:
    openssl pkcs12 -in ewallet.p12 -passin pass:<wallet_password> -out ewallet.txt -nodes
    - The resulting ewallet.txt is a file that contains the unencrypted private key, the certificate and all the root CA's in the wallet. Then the relevant information for the key, and certificate(s) can be copied to separate files to create the individual key and certificate(s)
    b. How to Convert a Certificate and Private Key to an Oracle Wallet
    SSL2OSSL (UNIX) and OSSLCONVERT (Windows) are tools that allow you to convert Private Keys and Certificates to an Oracle Wallet format. This format is required for Oracle Application Server. $ORACLE_HOME/Apache/Apache/bin/ssl2ossl
    Points to Note:
    * Even though capath, cafile, and chain are optional, at least one must be specified.
    * All the certificates that are being converted must be in base64 format.
    * If you are converting a self signed certificate, running ssl2ossl/osslconvert does not import the certificate as a Trusted Certificate. Therefore it is necessary to import the certificate as a Trusted Certificate in Wallet Manager after its converted, otherwise the Wallet will not work with Application Server.
    usage:
    $ ssl2ossl -cert /<path>/server.crt -key /<path>/private.key -cafile /<path>/rootca.crt -wallet /ssl/wallet -ssowallet yes
    Enter wallet password:
    Verifying password - Enter wallet password:
    SUCCESS
    This will create a ewallet.p12 file in /ssl/wallet

  • How can I use a COM object that does not have a type library?

    Hello,
    I've created a com server in python for which I do not have a type library. I am able to call functions for this application in Python, TCL, I'm sure VB, etc. without the type library.
    Must I have a type library registered to use this COM object with Labview? I was hoping I could simply supply the name to the refnum (or the GUID) then call functions by passings strings to the invoke node. This does not seem to be possible - am I missing something?
    In the event that I cannot use a com server without a type library. Any recommendataions on how to create one? I'm wondering if I can use the same GUID and create a shell in LabWindows which generates the IDL/TBD file I need for Labview to see my
    com server.
    Any help is greatly appreciated.
    73,
    Timothy

    Timothy Toroni wrote:
    > Thanks for the info, however their example is labview server and
    > python client. I'm going the other way. It's good to know about
    > LabPython though...
    >
    > As of now, it seems to be there is no way to use a COM object without
    > a type library from inside LabView.
    Yes that is true. LabVIEW needs that to configure the Property and
    Methode Nodes correctly. Otherwise it would need to have a special
    Property and Method Node with a configuration dialog similar to the Call
    Library Node, but a LOT more complicated. Not sure many people could
    make use of that, and it would be a very tiring experience trying to get
    things setup in that way, by going through the edit, test, and crash
    cycle over and over again.
    Rolf Kalberm
    atter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • IChat AV 3 works for me

    Hi 3 Chatters -- I decided to post this in the clear rather than posting it separately to several of you who are reporting problems others have reported to me in several (approximately 10) multi-party test chats in which I have participated since ins

  • Error In Mediator: ORAMED-01101:[Filter Expression Error]

    Hi All, Logic in Mediator: If Target_ID is "A", route to "Queue_A", If Target_ID is "B", route to "Queue_B", etc etc. This list of values has been maintained in DVM like mentioned below. <description/> <columns> <column name="DEST_SYSTEM"/> <column n

  • HELP installing itunes 7

    I recently got a 30 gb ipod, and i cant install itunes 7. I originally tried installing it at first, and it said cannot remove older applications of Apple Software Update. So i installed itunes 4 to put music on my ipod. Then i tried again to install

  • How to reveal the background layer through a cut-out?

    How can I cut out a shape from my PS image to expose the background layer?  I will "Save for Web" with a transparent background. The shape will be a rectangle, and a text layer will later be added to display within the rectangle. My goal is to use th

  • Thrid Party Scheduling Software BPC 7.0 SP5

    I'm curious if anyone out there uses something other than Data Manager/Windows Scheduler for running and scheduling their jobs.  As our compaines design currently stands we run multiple jobs quite frequently and could benifit from a scheduler that ha