Ensuring items are removed when session is destroyed

I have a Spring 2.5 MVC application with the ACEGI security framework on top of that. This application allows the user to upload many files and then "publish" them as a whole. I need to ensure that these files are deleted if the following happens:
1. The user clicks cancel (done, processCancel)
2. The session expires (trying HttpSessionListener)
3. The user navigates away from the page (This can probably fall under session expiration)
4. The user closes the browser(This can probably fall under session expiration)
Currently I implement the HttpSessionListener. I am not getting the same ID on sessionDetroyed that I am getting on sessionCreated. I'm assuming either the session is already destroyed before that event fires. Also, the sessionDestroyed event does not fire when I close the Firefox browser, but it does when I close Internet Explorer.
I was thinking that I can put a static reference to a map of files that need deleted on session expiration in the listener, but I'm still not sure how to link the session ID to the files or the username of the currently logged in user. Basically I need to verify that the files I am deleting do not belong to a user who is still logged in. Is there a better way to do this?

hoffmandirt wrote:
Currently I implement the HttpSessionListener. I am not getting the same ID on sessionDetroyed that I am getting on sessionCreated. I'm assuming either the session is already destroyed before that event fires. The sessionDestroyed event occurs after the session is taken out of commission but before it is invalidated. Every session gets destroyed and will have this sessionDestroyed event called. If you are using sessionEvent.getSession().getID() that will be the ID of the session about to be invalidated. It is hard to say why you are getting different sessions, but my guess is that you get the sessionID early in your app and somewhere you force a new session to be created and you are mixing the two sessions here. Some code may help figure this out. The second session would eventually expire, though, after the session timeout occurs.
Also, the sessionDestroyed event does not fire when I close the Firefox browser, but it does when I close Internet Explorer.Sessions are not destroyed when a browser closes. They are destroyed when you explicitly call a session.invalidate() or when the session times out. If you waited whatever period of time your session is set to timeout after you close the browser, that is when the sessionDestroyed method would be called.
>
I was thinking that I can put a static reference to a map of files that need deleted on session expiration in the listener, but I'm still not sure how to link the session ID to the files or the username of the currently logged in user. Basically I need to verify that the files I am deleting do not belong to a user who is still logged in. Is there a better way to do this?I personally don't like the static resource thing. It gets confusing when you start to worry about class loaders and is too easy to flub. Better would be a map stored in the application context that both your main application has access to and the HttpSessionListener (via the HttpSession object) has access to. But I would also think about wrapping the references to the file in a 'SessionFile' object which would implement HttpSessionBindingListener and would delete itself when the valueUnbound event occurs. So the file would be deleted when the session ends as well as when you simply delete it from the session. No need for an external map in the context/static scope, or an HttpSessionListener running in the background.
public class SessionFile implements HttpBindingListener {
    private final File file;
    private boolean fileInSession = false;
    public SessionFile(File file) { this.file = file; }
    public File getFile() {
        if (!fileInSession) {
            throw new IllegalStateException("Can not access File.  It is no longer stored in session.");
        return this.file; }
    public void valueBound(HttpSessionBindingEvent event) {
        this.fileInSession = true;
        /* any special action when added to the session? */
    public void valueUnbound(HttpSessionBindingEvent event) {
        this.fileInSession = false;
        // delete the file here
}

Similar Messages

  • Unable to cancel - open purchase order where all items are removed

    Hi all,
    When We try to cancel/close open purchase order where all items are removed from item master ?
    It showing error message,
    "No matching records found  'Items' (OITM) "
    Purcahse order was created on may-2007.
    As purchase order showing in open item list.
    Any solution for this problem ?
    Jeyakanthan

    SAP does allow items to be removed from the item master with open documents, but only if the documents have not created journals.
    It does create headaches though, and this situation is one of them.
    If there are not many items, I suggest you recreate the items, close the PO and just cancel the items rather than remove them.
    The other workaround is to change the items on the PO to something different that is in the item master, then close it.

  • Page items are cleared when calling javascript function for a buton.

    Hello,
    Can anyone please help me out with this issue.
    I have a reports region with some editable items and in which I have a button enter errors which opens up an popup window, but for this button i also have save process which updates the report and also calls the javascript function popup window. The reason I am saving the report is because the values entered by user needs to be updated in the table or otherwise the page will be reloaded clearing all the values entered by the user when i click the button enter errors. One more thing is that I also have two hidden items (P1_LOAN and P1_HERITAGE) in the reports region.
    Below is the javascript function which i am calling for the button and also setting the items P2_LOAN_NUMBER,P2_HERITAGE with the values &P1_LOAN.,&P1_HERITAGE.
    function ErrorPopup()
    popUp2('f?p=&APP_ID.:2:&SESSION.::&DEBUG.::P2_LOAN_NUMBER,P2_HERITAGE:&P1_LOAN.,&P1_HERITAGE.','_blank','scrollbars=0,left=200,menubar=0,resizable=0,width=400,height=500,toolbar=0,location=0,directories=0');
    doSubmit('ENTER_ERRORS');
    }And below is my pl/sql update process
    BEGIN
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
                 IF WWV_FLOW_ITEM.MD5(                                                      
                                           APEX_APPLICATION.G_f10 (i) ,
                                           APEX_APPLICATION.G_f11 (i) ,APEX_APPLICATION.G_f12 (i) ,APEX_APPLICATION.G_f13 (i)) <> APEX_APPLICATION.G_F45 (i) THEN
    -- Update tbl
              UPDATE sampl_tbl
              SET  col1     =      APEX_APPLICATION.G_f10 (i) ,
                         col2     =      APEX_APPLICATION.G_f11 (i) ,
                         col3     =      APEX_APPLICATION.G_f12 (i) ,
                         col4     =      APEX_APPLICATION.G_f13 (i)
                   WHERE pkcol    =      APEX_APPLICATION.G_f04 (i)         
         END IF;
    END LOOP;
    COMMIT;
    END;The only problem I have is, when I open up the popup window the hidden item values P1_LOAN and P1_HERITAGE are lost. Is their a way to set these item values within the session.
    thanks,
    Orton
    Edited by: orton607 on Jul 14, 2010 10:38 AM

    It HELPS when you solve an issue and POST that YOU SOLVED it, to SHARE the solution so others can learn from you found..
    Thank you,
    Tony Miller
    Webster, TX

  • Safari extensions are removed when behind proxy

    Since 10.7.4 (I'm guessing) my Safari extensions are removed whenever I login at my office location.
    I recive an error stating:
    "Safari can't use extension XYZ because the extension is no longer Valid"....
    The extension is then removed. Back home I can reinstall and use as normal.
    As I mentioned this is a relative new "feature"
    My company uses proxy servers, to manage Internet access.
    My Computer is not managed by IT, they have no permissions or control over it.
    This "feature" only occures when I'm in the office.
    All Extensions are removed!

    I have the same issue. I use the Cloak VPN when using free hotel wifi. When I connected yesterday, Safari dumped a bunch of my extensions - gone. I reinstalled some of the key ones and they worked fine. The wifi at his hotel is pay-per-day and when I signed up again this morning and used Cloak, Safari dumped the remaining extensions it did not trash yesterday, plus the two that I reinstalled.
    Using Safari 5.1.6 on Lion 10.7.4.

  • Leading zeros are removed when uploading excel

    Hi All,
    I have created a program to send an email with an excel attachment but the leading zero's in excel are removed. can anybody suggest what can be done other than replace since that exceeds 255chars so i cant concatenate.

    Hi
    Try adding the character ' (single quote) before the actual value. Excel then treats the value as-is whithout conversion
    character type for columns
    data: h_columns        TYPE ole2_object,
          h_cell           TYPE ole2_object.
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'F:K'.
    set property of h_columns 'NumberFormat' = '@'.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = 14
        #2 = 7.
    SET PROPERTY OF h_cell 'Value' = '0001'.

  • Calendar not updating on Iphone when items are removed from Outlook calendar.

    Recently a couple of my board members purchased IPhones and IPads. And I have set them up the best I can. If they create a calendar entry on the IPhone or IPad it will show up in Outlook right away. However if they or one of their admins log onto their Outlook calendars and remove a schedule meeting the entry will not delete off the IPhone or IPads. I know there is a 15 minute sync on the devices but I have tested them after hours and days and the entries are still on the calendars on the mobile devices. This creates serious issues when people show up to meetings and destinations that have been cancled days in advanced. If anyone knows anything about how to fix this please let me know.

    Do they log directly into the account or come in with proxy/delegate access? 

  • BAD: Outlook Calendar items are removed as they occur!

    I canceled my ME.COM account because it didn't work at all. The syncing affected my calendar and it looks like it tweaked something in iTunes.
    When I sync - it looks like iTunes decides to remove events from my calendar in Outlook 2007. This is *TOTALLY UNNACEPTIBLE*! If I sync several times a day (which I do) - my calendar entries that have passed dissapear!
    THIS WILL NEVER WORK for business. I am very dissapointed in the way iTunes works - I can't remove apps etc.
    This will drive me back to a blackberry if I am not able to get support from Apple. I hope they are listening.
    I need to sync bi-directionally and trust that the middleware won't destroy my data! This is not the case - I can no longer trust that ANYTHING coming from the iPhone will not destroy my Outlook calendar!
    Perhaps this is how Apple wants to ensure I switch to a Mac! Sorry for the rant - but I have tried unsuccessfully to get ANY support...

    Haven't seen this exact issue, but as part of a "best practices" document we prepared for users, we've told them NOT to update or accept appointments from any mobile device ( including IOS devices), just to do it from the Outlook client.  Microsoft has also published a couple of best practices documents which you should look at if you haven't.  Also, recurring meetings are a huge issue; for example, the MS best practices is only to create recurring appointments that won't change much, if at all...if there is a recurring meeting that changes frequently, it's better to schedule multiple individual instances of it than one recurring appointment. 

  • Recent items are missing when I do a four finger expose swipe or two finger tap on icon

    Hi,
    I used to be able to do a four finger down swipe when in an app which would show any app windows open plus recent items underneath. I'm currently getting the windows showing but no recent items. This goes for any app. I haven't changed anything. I haven't cleared the list either. Any ideas?
    Thanks

    Hello Toraishikuru,
    That feature you are describing is called Spaces. What the does is help you organize your workflow. For instance, my workflow is that have Safari in one space and then I have Mail in another so that they are not on top of each other. If you want to remove spaces that you are not using, then open Mission Control and you will see a section towards the top, move you mouse over one of them and click on the X that shows up in the right hand corner of that window. Take a look at the article below for more information. 
    OS X Mavericks: Work in multiple spaces
    http://support.apple.com/kb/PH14155
    Regards,
    -Norm G. 

  • Permissions for role in OLAP cube are removed when cube is rebuild

    Project Server rebuilds the OLAP cubes every 6 hours. I've recently added a role with "Process database" permissions, but this permission is removed each time the OLAP cube is rebuilt.
    I've read in a different thread (slightly older software versions) that to solve this issue, you can script and schedule the handling of permissions for that specific role, but it's not really a solution. The duration for the OLAP cube to rebuild varies
    in duration over time, and I'm not sure it's healthy to change the role permission on a cube when it's being rebuild.
    Is there a different, elegant way to solve this? I'm sure this can't be the intention?
    I'm running SQL Server 2008, Sharepoint 2010 SP2 and Project Server 2010 SP2

    sorry, i dont have much experience with project server. But, from the quick glance, it does look like as you said the configs are very limited including the ability to change user roles. My suggestion is that you take the cube solution and add the user to
    the role and redeploy to the AS. The assumption here is that, though you add the user manually, it is being written over with the old solution. 
    of course if you want to proceed with changing the roles via a script, you can schedule a job to run right after the cube has been processed each time. 
    probably better maintenance solution is to redeploy SSAS solution and reprocess. 

  • Custom jms headers are removed when a message pass through OSB's proxyservi

    Hi,
    I am using OSB 10.3. Trying to build the application withe the following flow.
    proxyservice(jms integration)-->businessservice(jms integration)-->MDB
    When a jms message with some custom headers are posted to a proxyservice, the custom headers are getting strippped off and only the plain jms message is received in the MDB and not the custom jms headers. I have enabled "Get all headers" option to "Yes" on the proxyservice. Do I need to do anything special to get those jms properties on to a MDB?
    Regards,
    Baskaran

    Did you try passing headers with "Set Transport Headers for[ Outbound Request ] " with option      Pass all Headers through Pipeline checked?
    Thanks
    Manoj

  • No items are returned when calling new SPWorkItemCollection(site, workitemtype)

    I have added SPWorkItems to the site using the AddWorkItem method. These items show up in the db with the type (GUID) I used when adding them.
    However, when trying to retrieve the items, using the new SPWorkItemCollection(SPSite, WorkItemType) nothing gets returned. Why?
    MOSS 2007 with SP2

    I imagine a new SPWorkItemCollection will instaniate a new collection which will be empty.  You need to use the SPSite.GetWorkItems http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.getworkitems.aspx
    Hope this helps
    DaveMy SharePoint Blog - http://www.davehunter.co.uk/blog

  • I need to upgrade Firefox V14 to V25. users personal settings and bookmarks not are removed when the new version is distributed. how can i do packaging ??

    I have to perform upgrade from Firefox 14.0.1 to Firefox 25.0.1.
    I have downloaded offline installer and installing it.
    i have downloaded and its installing fine for -MS .
    after launching the icon in desktop getting following prompts
    import The settings and data
    import install solutions, bookmarks, browsing history, lose the north, and other data from:
    Microsoft internet explorer(need to select this option)
    import not anybody Thing
    next
    valj homepage
    import home page from internet explorer (need to select this option)
    how i should suppose to suppress the this prompts.
    and also my new package should not delete the older book marks .
    support me to handle this case... :(

    Whenever your upgrading firefox browser, it updates only the browser it never remove your settings and bookmark. If you like the clean reinstall follow the below steps
    Note: clean reinstall removes everything from your system
    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!
    Thank you.

  • Additional / secondary Admin users are removed when changes are savedto GMS 2 config

    We recently upgraded from the GW Mobility Pack (Data Synchronizer)
    v1.2.5 (299) to the new GW Mobility Service v2.0.1 (53).
    With the previous versions of DataSync, I had two admin users setup:
    admin1 and admin2. Admin1 was the original administrator setup with the
    DataSync server, admin2 was manually added to the configengine.xml file.
    This worked fine for the last couple years.
    Since upgrading to GMS 2.0.1, I've found that when I make a change to
    the GMS configuration through the WebAdmin interface, "admin2" is left
    out of the configengine.xml file. After any change to the GMS
    configuration I have to manually go back into the configengine.xml file,
    add "admin2", and restart the services again.
    Anyone else seeing this?
    Thanks,
    Greg
    former e-mail for posting:
    [email protected]

    On 4/29/2014 9:06 PM, rlopez01 wrote:
    >
    > Hi,
    >
    > This is a known issue that was fixed in the next GMS release (2.0.2).
    >
    > Regards.
    >
    >
    Thanks for the update.
    -Greg
    former e-mail for posting:
    [email protected]

  • My folders are removed when syncing

    Whenever I sync my Ipad, Iphone or Ipod for updates the folders that i have put my apps into dissapear and I have to put them back into folders again.
    It's very annoying and time consuming.
    How can I stop this?

    I've found out the cause of the problem. The phone settings had changed, so that messages were being stored in the phone memory rather than on the SD card. I have changed this and all of my folders are back again now.
    However, I now have messages stored in phone memory and on the SD card. Is there any way that I can transfer the ones in phone memory to the SD card?
    Thanks.

  • CCleaner says there are uncleared items in history when I've set FF to clear everything on exit.

    Also, I clear the "History" (all items are checked) many times during browsing (shift+ctrl+del). The uncleared items found by Ccleaner include passwords, site preferences, cookies, etc. I have set up FF according to your "Help" topic on "History" to clear "Everything".

    Firefox uses SQL databases for the items that you are mentioning. As with other database structures, items are marked as deleted and are overwritten the next time something is added to the database. I know for a fact that when you use Internet Options to remove cookies and history items for IE which are kept a plain, readable text files, the items are removed from the directory but the actual data still exists on your hard drive until something else needs space to write data, then it is over-written. In both cases, until the data is over-written, it may be recoverable until over-written. Computers are riddled with security issues because so much data is left behind that is not apparent to the user, but can be recovered with sophisticated software and/or methods.
    The same is true when you delete a file on your hard drive, be it a text file, an image, or a video; the item is removed only from the directory, the actual information is still on your hard drive and can be retrieved, but it will be over-written the next time something is written to the hard drive.
    That is where a program like CCleaner is needed. If used properly, it will delete the data and/or file(s) by over-writing it with random characters several times, making it difficult or impossible to retrieve even with with most sophisticated recovery software. CCleaner is finding the SQL database files, and over-writing them several time with randam characters to make the near if not completely unrecoverable.
    In this regard, Firefox is more secure in that it does not keep cookies, passwords and other data in plain, readable text files as do many other browsers. Passwords in Firefox are encrypted and are virtually impossible for a human to decipher.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

Maybe you are looking for

  • Error while trying to generate tax invoice output

    Hi Gurus, I am trying to generate tax invoice output for the billing document at that time system is generating the following error message " Enter tax rate for  position 000010 document 6111000019".Actually I have maintained the Tax  condition recor

  • Group txt no longer works on iphone 4s

    I have just got my iPhone 4s, all looking great until I went to use a group txt app. I run a football team and used the group txt app (37 recipients) on the iPhone 4 all the time, tried to send group txt yesterday and it came up as an imessage and on

  • Is there a way to flip through an image album ?

    On some websites that use images albums you could flip through them on my computer and on the chrome app but not the Firefox app. Is there a plug in or something that will allow me to do that ?

  • Can't turn on Wi-Fi

    Hello, I can't turn on my wi-fi, I've read in different forums online and done every possible thing to try to resolve the issue but without any luck. I have tried, reseting my PRAM, reseting my SMC, using a new location, removing the wifi completely

  • Texts disappear from screen

    Hope someone can help.  For some reason, my text screen states "No entries in this view".  If a search a contact, their dialogue of texts appear.  I only see texts if a search a specific contact.  I went to my carrier and they are unable to fix.  The