You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Alex Dean (JIRA)" <ji...@apache.org> on 2010/09/28 19:23:40 UTC

[jira] Created: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Support ajax clients in multiple windows/tabs in a single browser
-----------------------------------------------------------------

                 Key: AMQ-2948
                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.4.1
         Environment: OSX 10.6
Centos 5.4
            Reporter: Alex Dean
         Attachments: support-multiple-ajax-clients-per-session.patch

In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.

The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.

For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Dejan Bosanac (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dejan Bosanac resolved AMQ-2948.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 5.5.0
         Assignee: Dejan Bosanac

Committed with svn revision 1022071. Thanks a lot for a great work.

I think there's two things left to be done to complete Ajax improvements:

* Documentation on Ajax is way out of date, so we should update it with these new features - http://activemq.apache.org/ajax.html
* We should automate JS tests and include them in our unit testing suite with something like WebDriver (http://code.google.com/p/selenium/wiki/GettingStarted)

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>            Assignee: Dejan Bosanac
>             Fix For: 5.5.0
>
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Alex Dean (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Dean updated AMQ-2948:
---------------------------

    Attachment: support-multiple-ajax-clients-per-session.patch

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Alex Dean (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Dean updated AMQ-2948:
---------------------------

    Attachment:     (was: support-multiple-ajax-clients-per-session.patch)

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Alex Dean (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Dean updated AMQ-2948:
---------------------------

    Attachment: support-multiple-ajax-clients-per-session.patch

This patch replaces the original one I attached to this ticket.

Changes since original patch:
 - private MessageListenerServlet.ClientConsumerState class refactored to AjaxWebClient (extends WebClient).
 - private MessageListenerServlet.Listener class refactored to AjaxListener.  AjaxWebClient uses an instance of Listener/AjaxListener, so this needs to be public.
 - AjaxWebClient & associated data for each client are now stored in a MessageListenerServlet instance variable (ajaxWebClients) rather than in sessions.
 - Timer/TimerTask code added to examine ajaxWebClients and clean up clients which have not been accessed in the past minute.  This solves the thread-leakage we were seeing in my initial patch.
 - JavaScript to append clientId parameter to all requests moved to amq.js, so no changes are required to the jquery, prototype, or dojo adapters.

New patch also includes a new JS test, and an updated chat.html which uses a clientId (so you can open chat.html in multiple windows in the same browser) for a quick test.

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Alex Dean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62210#action_62210 ] 

Alex Dean commented on AMQ-2948:
--------------------------------

We have observed that ActiveMQ running with this patch does not clean up session data as quickly as we expected.  (Every reload of a browser window which uses the clientId parameter creates 5 new threads in the JVM, and these do not appear to be cleaned up.)  We're going to investigate this a bit more and possibly submit a revised patch.

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2948) Support ajax clients in multiple windows/tabs in a single browser

Posted by "Alex Dean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62198#action_62198 ] 

Alex Dean commented on AMQ-2948:
--------------------------------

There's a separate minor change in the attached patch, which ensures that the Content-Type header is always set to 'text/xml'.

In current svn code, this header is only set when a message is delivered.  When a timeout occurs (and an empty <ajax-response></ajax-response> is returned), the Content-Type header is set to 'text/plain'.  The jQuery adapter attempts to parse the responseXML property of the response, which is not populated due to the Content-Type header being set to 'text/plain'.

This is seen in FIrebug as a 200 response resulting in a parseerror.  (Successful response which fired the error-handling ajax callback!)

> Support ajax clients in multiple windows/tabs in a single browser
> -----------------------------------------------------------------
>
>                 Key: AMQ-2948
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2948
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.1
>         Environment: OSX 10.6
> Centos 5.4
>            Reporter: Alex Dean
>         Attachments: support-multiple-ajax-clients-per-session.patch
>
>
> In current ajax code, there is a 1-1 relationship between ajax client and session.  Since multiple windows in the same browser share the same session, it's impossible for the ajax code to update both windows.  Either 1 or the other will receive messages, but not both.
> The attached patch allows an optional 'clientId' string to be passed to the JavaScript amq.init() function, similar to that supported by the REST servlet.  This clientId string is sent to the server with every ajax request.  In MessageListenerServlet, a new consumer is created for every new sessionid+clientId, allowing multiple windows in the same browser to send & receive messages independently.
> For some (currently) unknown reason, IE7 cannot send messages from multiple windows.  2 IE7 windows can receive messages independently with no errors, but once either IE7 window sends a message, both windows cease receiving data.  This behavior is not seen in FF (OSX or WinXP) or Safari (OSX).  All those browsers are able to send & receive simultaneously in multiple windows with no errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.