XTile doesn't handle response payloads larger than 4096 bytes in firefox
------------------------------------------------------------------------

                 Key: TAPESTRY-1899
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1899
             Project: Tapestry
          Issue Type: Bug
          Components: Contrib
    Affects Versions: 4.1.2
         Environment: Client: Windows XT/Firefox 2.0.0.9
Server: Windows XT/JBoss 4.0.4
Tapestry: 4.1.2
            Reporter: Peter Davison


The extractData method of the XTile component doesn't handle AJAX responses 
larger than 4096 bytes when using the XMLHttpRequest object - as opposed to the 
ActiveXObjects.

The problem is that extractData - as defined in XTile.script - only looks at 
the firstChild of the <sp> element as shown in the following code snippet:

        function extractData(response)
        {
                var xml = response.responseXML.documentElement;
                var dataList = new Array();
                if (xml) dataList = xml.getElementsByTagName('sp');
                var dataLen = dataList.length;
                var data = new Array();
                for (i = 0; i < dataLen; i++) {
                        var child = dataList[i].firstChild;
                        if (child)
                                data[i] = child.data;
                        else
                                data[i] = "";
                }
                return data;
        }

The following version of extractData fixes the problem by iterating over all 
children of the <sp> node:

        function extractData(response)
        {
                var xml = response.responseXML.documentElement;
                var dataList = new Array();
                if (xml) {
                        dataList = xml.getElementsByTagName('sp');
                }
                var dataLen = dataList.length;
                var data = new Array();
                for (i = 0; i < dataLen; i++) {
                        var children = dataList[i].childNodes;
                        data[i] = "";
                        for (j = 0; j < children.length; j++) {
                                var child = children[j];
                                if (child) {
                                        data[i] += child.data;
                                }
                        }
                }
                return data;
        }

Tested in both IE and Firefox and this change works properly in both cases.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to