ICEfaces
  1. ICEfaces
  2. ICE-4217

Provide callback registering API for listening to connection and bridge specific events

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8RC1
    • Fix Version/s: 1.8
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      supported browsers
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)

      Description

      Provide callback registering API for listening to connection and bridge specific events so that application developers can enhance UI experience or integrate with other third party JS libraries.

        Activity

        Mircea Toma created issue -
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18580 Mon Mar 16 09:21:33 MDT 2009 mircea.toma ICE-4217 Add bridge and connection event notification methods.
        Files Changed
        Commit graph ADD /icefaces/trunk/icefaces/bridge/src/callback.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/application.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/build.xml
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/submit.js
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18581 Mon Mar 16 09:25:40 MDT 2009 mircea.toma ICE-4217 Rename function.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/callback.js
        Mircea Toma made changes -
        Field Original Value New Value
        Assignee Mircea Toma [ mircea.toma ]
        Mircea Toma made changes -
        Salesforce Case []
        Fix Version/s 1.8RC2 [ 10163 ]
        Hide
        Mircea Toma added a comment -

        Added bridge and connection event notification methods.

        Show
        Mircea Toma added a comment - Added bridge and connection event notification methods.
        Hide
        Mircea Toma added a comment - - edited

        Here are the provided event registration functions:

        Ice.onSendReceive(id, sendCallback, receiveCallback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        sendCallback – callback invoked when the request is initiated
        receiveCallback – callback invoked when response is received

        Ice.onAsynchronousReceive(id, callback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        callback – callback invoked when a push response is received

        Ice.onServerError(id, callback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        callback – callback invoked when server side error occurs, the callback gets the content/body of the response in its first parameter

        Ice.onSessionExpired(id, callback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        callback – callback invoked when session expired or it was invalidated

        Ice.onConnectionTrouble(id, callback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        callback – callback invoked when heartbeat pings are lost (asynchronous mode)

        Ice.onConnectionLost(id, callback)
        id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element)
        callback – callback invoked when connection to server was lost

        Show
        Mircea Toma added a comment - - edited Here are the provided event registration functions: Ice.onSendReceive(id, sendCallback, receiveCallback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) sendCallback – callback invoked when the request is initiated receiveCallback – callback invoked when response is received Ice.onAsynchronousReceive(id, callback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) callback – callback invoked when a push response is received Ice.onServerError(id, callback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) callback – callback invoked when server side error occurs, the callback gets the content/body of the response in its first parameter Ice.onSessionExpired(id, callback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) callback – callback invoked when session expired or it was invalidated Ice.onConnectionTrouble(id, callback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) callback – callback invoked when heartbeat pings are lost (asynchronous mode) Ice.onConnectionLost(id, callback) id – the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the 'body' element) callback – callback invoked when connection to server was lost
        Mircea Toma made changes -
        Salesforce Case []
        Affects [Documentation (User Guide, Ref. Guide, etc.)]
        Hide
        Mircea Toma added a comment -

        For example, to show a popup on session expiry this is what is needed:

        .......
        <body id="document:body">
        <script type="text/javascript">
        Ice.onSessionExpired('document:body', function()

        { alert('Session has expired!'); }

        );
        </script>
        .......

        Show
        Mircea Toma added a comment - For example, to show a popup on session expiry this is what is needed: ....... <body id="document:body"> <script type="text/javascript"> Ice.onSessionExpired('document:body', function() { alert('Session has expired!'); } ); </script> .......
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Assignee Mircea Toma [ mircea.toma ] Ken Fyten [ ken.fyten ]
        Hide
        Tyler Johnson added a comment -

        I've tested the new onSessionExpiry method from the API and found the following:

        1. When session expires naturally, Ice.onSessionExpired() is called and everything works great.

        2. When I manually invalidate the session, the method is not called.

        Attached is a sample app that reproduces the issue. It is a facelets application intended for deployment on tomcat 6. Run the application and click login. This will popup a new screen with a logout button and graphic image. Try letting the session timout naturally (set at 1 minute) and you will see that the javascript alert is called and that the window is automatically close (window.self.close() in the javascript). What I've noticed is that if you click logout (which invalidates the session), the js is not called. The javascript is in the facelets template.jspx file.

        Show
        Tyler Johnson added a comment - I've tested the new onSessionExpiry method from the API and found the following: 1. When session expires naturally, Ice.onSessionExpired() is called and everything works great. 2. When I manually invalidate the session, the method is not called. Attached is a sample app that reproduces the issue. It is a facelets application intended for deployment on tomcat 6. Run the application and click login. This will popup a new screen with a logout button and graphic image. Try letting the session timout naturally (set at 1 minute) and you will see that the javascript alert is called and that the window is automatically close (window.self.close() in the javascript). What I've noticed is that if you click logout (which invalidates the session), the js is not called. The javascript is in the facelets template.jspx file.
        Tyler Johnson made changes -
        Attachment SC8053.war [ 11629 ]
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Assignee Priority P2
        Assignee Ken Fyten [ ken.fyten ] Mircea Toma [ mircea.toma ]
        Ken Fyten made changes -
        Salesforce Case []
        Fix Version/s 1.8 [ 10161 ]
        Fix Version/s 1.8RC2 [ 10163 ]
        Hide
        Mircea Toma added a comment -

        The logout test case used for testing the JS listener is not the best suited test for this issue. The logout process creates a border case situation where the framework specifically chooses not to send the session expired message to avoid shutting down the bridge to early. If the bridge is shut down, the redirection to login page would not work anymore. This logout specific logic is implemented in the update coalescing policy.

        I recommend to change the test case so that redirection is not trigger, but only invalidate the session.

        Show
        Mircea Toma added a comment - The logout test case used for testing the JS listener is not the best suited test for this issue. The logout process creates a border case situation where the framework specifically chooses not to send the session expired message to avoid shutting down the bridge to early. If the bridge is shut down, the redirection to login page would not work anymore. This logout specific logic is implemented in the update coalescing policy. I recommend to change the test case so that redirection is not trigger, but only invalidate the session.
        Ken Fyten made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Assignee Priority P2
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Mircea Toma [ mircea.toma ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Mircea Toma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: