Invalidate connection to BlazeDS server when closing tab in browser

There is an issue using IE and blazeds. When you establish a connection to blazeds from a tab of your browser, even when the tab get closed, she connection remains. The session doesn't get invalidated. It looks like it works fine in Firefox but it's an issue in IE.
It is especialy important if you are build a chat room for example ... you want to know precisly when someone is leaving the room.
I finally found an answer to this problem. I didn't find any answer on the Internet so I felt that I should share it.
I invalidate the session on the server side using a servlet.
Here is the code:
In my flex app html template I add:
<script langugage='javascript'>
    function disconnectAll(){
            if (navigator.appName == "Microsoft Internet Explorer")
                  xhr = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer
            else
                      xhr = new XMLHttpRequest();
            if (xhr) {
                xhr.open("GET", "../disconnect", false);   
                xhr.send(null);
</script>
</head>
<body scroll="no" onunload="disconnectAll()" >
This call to ../disconnect does a http request to my servlet that will invalidate the connection.
Here is the servlet code:
public class Disconnect extends HttpServlet {
    private static final long serialVersionUID = 1L;
    @Override
    public void doGet(HttpServletRequest httpRequest, HttpServletResponse response) {
        System.out.println("doGet disconnect called !");
        httpRequest.getSession().invalidate();
This has to be added in the web.xml for the servlet to be accessible:
    <servlet>
        <servlet-name>DisconnectServlet</servlet-name>
        <display-name>DisconnectServlet</display-name>
        <servlet-class>com.ms.advil.servlets.Disconnect</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>DisconnectServlet</servlet-name>
        <url-pattern>/disconnect</url-pattern>
    </servlet-mapping>
That’s it ! On the unload of the page, an Ajax request is made to the servlet that will invalidate the http session.
Your browser’s connections get invalidated and blazeDS catches the disconnection.
Hope this will help
Cheers

answered

Similar Messages

  • Mountain Lion freezes for few seconds when closing tabs

    Hi all,
    When closing tabs on Google Chrome, usually after "heavy" navigation (HD flash video or several pdfs opened for examples), Moutain Lion sometimes freezes for less than 10 seconds and then back to normal. The trackpad is still responsive but I can't do anything appart moving the pointer. It appears around two times in one hour. In never appends with other applications like Photoshop or games.
    This may be already a known issue on ML, but all the reports I read were pretty old and not exactly similar. Here some details :
    Recent Mid 2012 Retina MBP (only 15 battery cycles)
    Os X 10.8.2 ; 2.6Ghz ; 16GB
    I *nerver* connected it to any external displays.
    Console logs :
    stampWait: Overflowed checking for stamp 0xa3694c3 on MAIN ring: called from
    timestamp = 0xa3694c2
    ****  Debug info for *possible* hang in MAIN graphics engine  ****
    ring head    = 0x00000000, wrap count = 0
    ring tail    = 0x00000cf0
    ring control = 0x00000000   disabled, auto report disabled, not waiting, semaphore not waiting, length = 0x001 4KB pages
    timestamps = 0xa3694c2
    Semaphore register values:
    VRSYNC: (0x12044) = 0xa3694c2
    BRSYNC: (0x22040) = 0x0
    RVSYNC: (0x 2040) = 0x0
    BVSYNC: (0x22044) = 0x0
    RBSYNC: (0x 2044) = 0x0
    VBSYNC: (0x12040) = 0x0
    CGXMuxAcknowledge: Posting glitchless acknowledge
    Received display connect changed for display 0x4280380
    Received display connect changed for display 0x3f003d
    Received display connect changed for display 0x3f003e
    Received display connect changed for display 0x3f003f

    Those log messages indicate a fault in the graphics processor. Take the machine in for warranty service. Make sure you can reproduce the problem.

  • Custom plugin crashes repeatedly when closing tabs

    Hello,
    Our company has a custom plugin which we install onto firefox in order to connect to its API.
    lately a customer complained that our plugin is crashing repeatedly. all i have to go on is this crash report for now:
    https://crash-stats.mozilla.com/report/index/ff38c405-4289-4b72-a82d-fd67a2141208#rawdump
    can anyone help with this?

    The first crash reported seems to be crashing in visual studio. If you are using this to create a website, try a new profile to see it has to do with the interaction with your plugins. [[Use the Profile Manager to create and remove Firefox profiles]] though if they are needed, this might not work. Disable the plugin [plugin PageHook Version:6.0.0.0 Filename:nppagehook.dll ] as this was reported as the culprit of the crash.
    A bug has just been filed for this the second crash and will need further investigation. However it does look like it is crashing in the plugin operation. It is it possible, can you please try to disable you plugins to see if it crashes again.
    Since this also happens when closing tabs and the first crash is hanging please see these steps to prevent hangs: [[Firefox hangs or is not responding - How to fix]]

  • Both my iphone 4s and my ipad3 will not connect to the server when trying to access my email account. Why, and how do I fix it.

    Since 29/10/2012 my iphone 4s and more recently my ipad 3 will not connect to the server when trying to access my email account. All I get is an error message saying that 'cannot get mail, connection to the server failed' I hadnt changed any settings it just happened. I have since done a complete re-boot on the ipad but to no avail. Anybody got any suggestions?

    No. Everything was working fine and then it wasn't. I hadn't changed any settings or switched either one off. When the phone stopped working properly I ignored it because I always have my ipad with me but that just sopped working properly and now I am stuffed. I have tried most solutions suggested on here even wiping the ipad clean and re-booting. I did this exactly the same way as when I first got it but still no joy. The same with the phone.

  • Suddenly, thunderbird doesn't connect to remote server when i click "get messages".

    Linux (ubuntu studio), 64 bit. Suddenly, thunderbird doesn't connect to remote server when i click "get messages". It just says "(account name): Connected to (mail server)" for a second or two at the bottom, then nothing. In the server logs, i get:
    popa3d[6408]: Didn't attempt authentication
    Trying to get my e-mail also seems to cause a bunch of these errors on the server:
    (server) kernel: [18295.775491] lockd: cannot monitor laptop
    where "laptop" is the client machine.
    The problem seems to be caused by my mailbox files (Inbox and Inbox.msf) - when i create a clean ~/.thunderbird directory, i can get my e-mails, but when i place my mailbox files in this account's Mail directory, the problem comes back. Even if i place it as another name, and not Inbox.

    I should add the following information:
    - Neither "safe mode" or rebuilding the global-messages-db.sqlite file fixes the problem.
    - Seamonkey has no problems with my Inbox and Inbox.msf file.
    - The Inbox and Inbox.msf files are symlinks to files on a NFS filesystem.
    - Downgrading to an earlier version of thunderbird doesn't fix the problem.
    - Even if i remove the mail file from an account, the problem persists.
    - I confirmed that i can telnet to the server on the pop3 port and login with the raw protocol.
    The above mentioned lockd errors make me think this is a NFS related error, but if that's the case, why is seamonkey able to read my Inbox file without problems but not thunderbird?

  • Safari 6.1 freezes and then can't connect to the server when I refresh the page

    Hi everyone.
    I have a Mid 2010 13" Macbook. It is running the following..
    Processor: 2.4 GHz Intel Core 2 Duo
    Memory: 4GB 1067 MHz DDR3
    Graphics NVIDIA GeForce 320M 256 MB
    Software OS X 10.8.5 (12F45)
    Hard Drive: 320GB
    Recently Safari has been acting up. Everything will be working fine but then it will freeze and when I switch to another tab that tab will be white, as will all other tabs when I switch to them. When I refresh the page it force refreshes all other pages but on a lot of the pages (Facebook, Twitter, google, Gmail, mostly things with a password I think) it says that it can't make a secure connection to the server. I tried switching to Chrome and the same thing happened and then I switched to the Guest User and the same thing happened.
    It has also been telling me that I have no more space on the startup disk but I'm not sure how that can be the case. I currently have 272GB free of a 319GB hard drive so I'm not sure what the problem is here! When I restart the mac everything is fine again but I have noticed it is taking longer for the mac to start up now. I have repaired disk permissions, I have reset Safari and cleared the history. I have downloaded OmniDiskSweeper and it has told me that the highest usage is in Spotify caches and my Gmail folder. So I deleted the Spotify caches and deleted all my emails. I then tried to delete the mail folder in Finder but when I do it just builds itself back up again.
    When I used Disk Utility to verify the disk it found no issues.
    I tried to shut down and restart it to run the hardware test but it doesn't boot up, it just takes a lot longer to reach the log in screen.
    I don't know what else to try! Any help would be welcomed.

    Try this DNS server ..
    Open System Preferences > Network > Advanced > DNS
    Click + and type:
    208.67.222.222
    Click + again and do the same.
    208.67.220.220
    Click OK.
    Quit and relaunch Safari to test.

  • Mac keeps trying to connect to a server when opening excel

    i worked for a week at a production house and they had me log into their server to access files that we all used.  obviously i forgot to eject their server before i left and instead just closed my computer and left.  now, since Lion makes all documents that were left open restore automatically my mac keeps trying to load a spreadsheet that i was reading off the server but obviously i'm not connected to said server anymore.  and i won't ever again. 
    how can i stop my mac from trying to connect to this server?  also, is there a way to stop Lion from auto restoring?
    thanks, all!

    Well, I was hoping that if you remove all traces of recently opened documents to resume and you disable the resume, then Excel would not try any longer to connect to the server.
    One more question: is Excel trying to reach the server when you start your system or when you launch Excel?
    If it happens at start up, then have a look, if Excel has been added to the start up items (System preferences -> accounts -> your account -> start up items) and remove it.
         Quit Excel (with Option + Command + Q) if it is open and remove the loginwindow preferences: Navigate to Library > Preferences > ByHost > com.apple.loginwindow.[xxxxxxxxx].plist
    The [xxxxxxxx] represent some interminable string of numbers and letters.
    If it happens at launch time, move the Excel preference file to the Desktop before you launch Excel. The file is locate here:
    /Users/your user name/Library/Preferences/com.microsoft.Excel.plist.
    If you keep your Library hidden, as it is by default, go to the System preference folder from the Finder menu: Finder -> Go -> Go to Folder (Or shift-cmd-G) and enter
    "/Users/your user name/Library/Preferences"
    Good luck

  • There was a problem connecting to the server when opening Chrome or Evernote

    At one time I had an external network drive that is now dead.  I have remove it from the login items and the Finder list of recent servers, but whenever I open Chrome or Evernote I receive a series of "There was a problem connecting to the server" messages. Eventually the messages stop and both Chrome and Evernote work normally.
    I've looked at the Chrome and Evernote settings and preferences and I cannot find any setting that tells them to connect to the old network drive.
    I've also used the Console app and when the error message comes up I see...
    11/18/14 2:44:38.023 PM NetAuthSysAgent[419]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    11/18/14 2:44:38.024 PM NetAuthSysAgent[419]: ERROR: AFP_GetServerInfo - connect failed 64
    Any ideas on where to look and how to get rid of this?

    I understand you are getting unable to connect to server error message on your printer. I would first unplug router and printer for about 1 minute. I would plug router up first then printer. I would then try to enable web services. If not successful and you get same error message. I would follow these steps.
    1. Obtain your printer's IP address
    a. This can be done by pressing the wireless icon on printer.
    2. Enter the printer's IP address in a browser.
    3. Select the network tab at the top of the page.
    4. On the left select networking.
    5. Select Network Address (IP)
    6. Select Manual DNS Server
    a. Manual Preferred DNS should read 8.8.8.8
    b. Alternate DNS Server should read. 8.8.4.4
    7. Select apply you might get a warning just select okay.

  • Lync client cannot connect to Exchange Server when accessing from outside (Internet) - please HELP!

    Hello,
    I have full representation of the Lync 2010 from Outside (i.e. Internet), but I still have small issue related to Lync-to-Exchange integration. Clients who is using Lync client from outside (i.e. Internet) cannot see Exchange-related information including
    Call Logs, Voicemail and Calendar information.
    Here is the experience and error messages that anyone will see when connecting to Lync server from Outside:
    And this is the error message that will be displayed on Lync phone edition devices (a.g. Polycom CX-700) when connected from Internet:
    If somebody can suggest what I can try I would appreciate this very much. I do believe that many other people have this issue as well.
    Thanks!

    Hi, we had this issue and I ended up logging a MS support job. Turns out it was the TMG rule/Auth method causing the issue.
    Job details:
    **Symptom:
    Lync Client External User are not able to retrieve the EWS URL
    **Troubleshooting:
    • We found External users are not able to Retrieve the EWS information in the Lync Client .
    • We found the below error in the ETL logs.We found for EWS request we are getting the  401 response
    HTTP/1.1 401 Unauthorized ( The server requires authorization to fulfill the request. Access to the Web server is denied. Contact the server administrator.  )
    • TMG need pass through Authentication
    Public names are  autodiscover.domain.com and Outlook anywhere External FQDN  and paths are /ews/* and /autodiscover/*, OAB/*
    Users is All Users, and Delegation is "No delegation but client may authenticate directly" on the corresponding tabs of the publishing rule.
    This changes is required for Lync Client as Lync Client does not  work well with this BASIC authentication on TMG .
    • After  TMG engineer changed this settings in the TMG users are able to see EWS information.
    RELATED ARTICLES:
    Configure Certificates for Servers
    http://technet.microsoft.com/en-us/library/gg398995.aspx
    Associate a Subnet with a Network Site
    http://technet.microsoft.com/en-us/library/gg412804.aspx
    Deploy Office Web Apps Server
    http://technet.microsoft.com/en-us/library/jj219455.aspx
    Reset-CsPoolRegistrarState
    http://technet.microsoft.com/en-us/library/jj619172.aspx
    Manage Access Edge Configuration for Your Organization
    http://technet.microsoft.com/en-us/library/jj552443.aspx
    http://technet.microsoft.com/en-us/library/gg182549.aspx
    Edge Certificate
    http://technet.microsoft.com/en-us/library/gg398409.aspx
    Edge Deployment
    http://blogs.technet.com/b/nexthop/archive/2012/05/15/lync-server-2010-geographically-dispersed-edge-topology-part-1.aspx
    http://blog.schertz.name/2012/07/lync-edge-server-best-practices/
    http://blog.schertz.name/2012/04/lync-server-2010-deployment-part-4/
    http://technet.microsoft.com/en-us/library/gg425891.aspx
    http://blogs.technet.com/b/nexthop/archive/2010/11/17/microsoft-lync-server-2010-protocol-workloads-poster.aspx
    MRAS
    http://blogs.technet.com/b/dodeitte/archive/2012/06/22/issues-with-mras-and-limited-external-calling.aspx
    http://blogs.technet.com/b/ucedsg/archive/2011/05/09/what-can-you-tell-me-about-lync-security.aspx
    IIS ARR Configuration for  Lync 2013
    http://blogs.technet.com/b/nexthop/archive/2013/02/19/using-iis-arr-as-a-reverse-proxy-for-lync-server-2013.aspx
    http://social.technet.microsoft.com/wiki/contents/articles/15893.iis-arr-url-rewrite-for-lync-2010-reverse-proxy.aspx
    Archiving Options in Lync Server 2013
    http://blogs.technet.com/b/dodeitte/archive/2013/04/24/archiving-options-in-lync-server-2013.aspx
    http://blogs.technet.com/b/dodeitte/archive/2013/06/02/sample-lync-server-archiving-report-available.aspx
    Microsoft Lync Server 2010 Resource Kit
    http://www.microsoft.com/en-us/download/details.aspx?id=22644
    Microsoft Lync Server 2013
    http://technet.microsoft.com/en-us/library/gg398616.aspx
    Microsoft Lync Server 2013 RTM Documentation
    http://blogs.technet.com/b/nexthop/archive/2012/10/24/microsoft-lync-server-2013-preview-rtm-documentation-now-available.aspx
    Release Notes for Lync Server 2013
    http://technet.microsoft.com/en-us/library/jj205120.aspx
    Integrating Exchange 2013 Preview and Lync Server 2013 Preview
    http://blogs.technet.com/b/nexthop/archive/2012/07/23/integrating-exchange-2013-preview-and-lync-server-2013-preview.aspx.
    Migration from Lync Server 2010 to Lync Server 2013
    http://technet.microsoft.com/en-us/library/jj205369.aspx
    Lync Online Resource
    http://www.microsoft.com/en-in/download/details.aspx?id=13602

  • Mail.app doesn't hava connection with imap server when changing network.

    Ive got a strange problem after upgrading OSX from 10.6.8 to 10.8.4.
    I have got a xserve, with osx 10.6.8. (mail) server installed on it.
    When i am in the office (LAN) mail works just fine. if iam home and wake my macbook from sleeping i see in the mail app the attention mark telling my something is wrong with the mail account.
    If i open the connection doctor it say's can't connect to IMAP server. if i check my iOS devices there is nothing wrong, everything is working and i can send/recieve mail. on iOS and OSX the settings are the same with SSL enabled and password type.
    When i tried to telnet the mailserver address with the IMAP or SMTP port i get a connection. so, there is no firewall blokking my connection.
    But now the strange thing when i quit my mail.app and start it again the mail gets connection again. So is there a problem when changing networks when the Mail.App is stil active?

    That's just to bad, will it be solved in a future release of OSX?
    I don't know... maybe Apple will force me migrating to Mavaricks.
    it seems that although w'r using DNS, the outside ip gets remebered or the connection isn't closed down properly when putting the macbook to sleep.
    I can try offcource to configure the outside LANip (Non dns) in my mail client.
    I will post with results..

  • Server Admin not connecting to Leopard Server when accessing via VPN

    Hi everyone,
    Recently, as the title suggests, Server Admin (or Server Preferences, for that matter) would not connect to my remote server via VPN. I'm quite sure that the server is working nicely, as the users (both of them lovely young ladies with considerable charms, which makes on-site support quite interesting, if distracting) didn't call me to complain, and I can login via SSH with no problems.
    The server is a Mac Mini, connected to an Airport Extreme (gigabit N), which in turn connects to our ADSL modem, if that helps any.
    Now, I did tinker around a bit with the settings before this happened, so I think it's probably my fault (well, I started my "career" of administering this server a week ago, what do you expect), so I suppose I may have inadvertently limited access to a service required for Server Admin and Server Preferences to function.
    If anyone could tell me which services are absolutely necessary for Server Admin to function, or at least where to start looking, I'd be immensely grateful. I didn't yet go on site to try and wrestle the whole thing from there, as the travel costs are non-trivial, so I'd rather do it remotely, if at all possible.

    This is exactly the difficulty I am having with a 10.5.4 Intel xserve. I have established a VPN connection that connects me to my business LAN, and I know it has carried out the connection because there are a number of things I can access properly that are not available on the public internet. For instance, my LOM ports are restricted to my business LAN, and when I connect to the server via VPN I can access teh LOM ports and using server monitor. However, when I try to use Server Admin, nothing works. It won't connect. I too am confused. All traffic to the xserve is allowed via the business LAN. I thought all traffic was supposed to be routed to the VPN server when connected via a VPN. If this is the case, shouldn't Server Admin work? When I go on site and connect my computer directly to the business LAN, I have no difficulty using Server Admin.

  • Error connecting to Essbase Server when running business rules

    We recently migrated from v9.3 to v11.1.1.3. I have two users with Administrative access who need to run business rules on a native Essbase application, but cannot. They get the message 'Error connecting to Essbase Server'. They get this message when trying to set this execution database. They can't even expand the server to see the list of applications. I have tried deprovisioning them in Shared Services, refreshing security, then adding it all back in and refreshing again, but it doesn't work. My own id has identical access to that which I'm granting them, and I have no problems. I even created a native user with the same access and it works as well. No matter what I do, I cannot get these two users to be able to run their business rules in EAS.
    We also have a Planning application, and the Planning Administrative user has the same issue. However, this user is able to get around it by running rules using the Planning connection rather than the Essbase connection. She has the same issue of not seeing anything under the Essbase Servers when trying to set the execution database though.
    In version 9, we were not using Shared Services for Essbase security. Unfortunately our consultant chose to set it up using Shared Services security when migrating, and according to the documentation, one cannot go back to using Native Essbase security.
    I also tried running the Externalize Users wizard and the three users with issues failed to externalize. My own id did, and the native user I created succeeded.
    Has anyone experienced an issue like this or have any ideas on how to resolve?
    Thanks,
    Sabrina

    Follow up - Oracle has finally resolved this. It's so simple, yet no one thought to check until now. The three users with problems all have mixed case user id's in ldap. They have always logged into EAS with all lower case ids. In version 9, on native security, this was never a problem. But in version 11 using Shared Services (not sure which factor changed it), it doesn't work. The simple solution is to log in with their exact mixed case user ids. It only took Oracle three months and the creation of a bug issue to figure this out for us.
    Sabrina

  • Recieving Error connecting to Planning server when validating BusinessRule.

    Hi,
    I am recieving an error when validating business rules.
    Internal error connecting with given connection information. Get details for more information.
    When I click on Get Detail I see the below information.
    Details:Error connecting to Planning server xxxxxx.
    Details:Exception occurred. Please check your log file for details.
    I do have one more issue I cannot access Applications through Web. Recieving the following error Unsuccessful Logon Check Log for details.
    Hyperion Planning Version is 9.2.
    Please help.
    Thanks.
    Edited by: user8887080 on Aug 18, 2010 1:39 PM

    I recommend logging into My Oracle Support and having a read of doc id - 763345.1
    It goes through different options for resolving business rules issues.
    Though you will need to be able to log into your planning applications first, make sure all your connection information is correc e.g. the connection details to the relational databases.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Warning When Closing Tabs

    Is there a way to have a warning notification prior to closing out all tabs, when multiple tabs are open?

    The prefs for the warning message have been set to false as the default in current Firefox 4 beta versions.<br />
    [https://bugzilla.mozilla.org/show_bug.cgi?id=592822 Bug 592822] – Remove quit warning dialog ''(please do not comment in bug reports)''
    You can set the warn prefs on the about:config page to true via the right-click context menu or toggle with a double left-click.
    * browser.tabs.warnOnClose , see http://kb.mozillazine.org/About%3Aconfig_entries
    * browser.warnOnQuit , see http://kb.mozillazine.org/browser.warnOnQuit
    * browser.warnOnRestart , see http://kb.mozillazine.org/browser.warnOnRestart

  • Mail won't connect to SMTP server when using wireless instead of ethernet

    I receive the following error message ONLY when I am online via a wireless connection, but not when I am online via an ethernet cord:
    *This message could not be delivered and will remain in your Outbox until it can be delivered. The connection to the server "smtp.XXXXX.com" on port 2525 timed out.*
    (note that XXXX is just the name of my mail server that I've removed for security reasons)
    I am able to receive email fine regardless of whether I'm using a wireless or ethernet connection.
    Any thoughts? I've occasionally run into this issue before (at coffee shops and such) and think it may have something to do with the type of wireless connection (too weak, low security, other?) I'm particularly stumped about this one though since it's simply the wireless network at my college which has worked fine in the past (though perhaps they did change something?)
    Thanks!

    That's because the internet provider whom you are connecting to via wireless is blocking that port/server address as a security measure.
    Unless you have an account with whom the host is, you wont be able to send emails...
    you could try setting the outgoing port to one of the following you could have some luck, no guarantee's though...
    21, 25, 5521, 5525, 7721, 7725
    hope that works
    edited by nerd2

Maybe you are looking for

  • Text / Titles Get Cut Off After 3 Lines?

    I did some searching but couldn't find a discussion on this. When I add a Title of any kind and try to fill it with more words that fit on the screen (in vertical space) it just cuts them off at the bottom. I've attached an image that shows the third

  • Variable passing with PSP

    I have two pages, one with a few controls and the toher that should ouput a table. When I pass the variable data between pages I am getting a 404 error. When I hard code in the where clause I pull back the correct data. What am I doing wrong. The cod

  • NWDS - "Import Model" Window - Password field is disabled

    Hi, I am using the below version of NWDS; Version: 7.0.14 Build id: 200711171656 When i try to import/re-import a model, the Password field on the Import Model Window is disabled. Can anyone please suggest what should i do to get this enabled. I am u

  • IS - Policy evaluation performance

    Hi all, I am trying to find out why a policy evaluation takes over a second. The request is generated using C API, IS and DS are running on different machines. Don't think there is a networking problem. IS version is 6.1 My questions are: - Are there

  • Suddenly fla will not render to swf; freeze; CS3

    I have been making swf's for a long time, but suddenly today, my last one for a project, it will not render, and program freezes solid.  What should I do?  The fla seems ok. preview in html will not work.  Restarts and permissions did not work. AS 2.