]> source.dussan.org Git - vaadin-framework.git/commitdiff
Modified vaadinBootstrap to send v-loc as POST instead of GET (#13685).
authorTapio Aali <tapio@vaadin.com>
Tue, 29 Apr 2014 12:56:43 +0000 (15:56 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 29 Apr 2014 13:03:47 +0000 (13:03 +0000)
Since there seems to be no difference, moved also almost all other
parameters from GET to POST for consistency.

Change-Id: I528963c4c832339a9853fbee97cebcb8fabb35e1

WebContent/VAADIN/vaadinBootstrap.js

index bab759b8129ee8df6a5e5706c0eb037ecb7c18df..fc0fb9b94817e37043ed9f5e1050fbfbb00a3329 100644 (file)
                                        // No special url defined, use the same URL that loaded this page (without the fragment)
                                        url = window.location.href.replace(/#.*/,'');
                                }
-                               url += ((/\?/).test(url) ? "&" : "?") + "v-browserDetails=1";
+                               // Timestamp to avoid caching
+                               url += ((/\?/).test(url) ? "&" : "?") + "v-" + (new Date()).getTime();          
+                               
+                               var params = "v-browserDetails=1";
                                var rootId = getConfig("v-rootId");
                                if (rootId !== undefined) {
-                                       url += "&v-rootId=" + rootId;
+                                       params += "&v-rootId=" + rootId;
                                }
 
                                // Tell the UI what theme it is configured to use
                                var theme = getConfig('theme');
                                if (theme !== undefined) {
-                                       url += '&theme=' + encodeURIComponent(theme);
+                                       params += '&theme=' + encodeURIComponent(theme);
                                }
                                
-                               url += "&v-appId=" + appId;
+                               params += "&v-appId=" + appId;
                                
                                var extraParams = getConfig('extraParams')
                                if (extraParams !== undefined) {
-                                       url += extraParams;
+                                       params += extraParams;
                                }
                                
-                               url += '&' + vaadin.getBrowserDetailsParameters(appId); 
-                               
-                               // Timestamp to avoid caching
-                               url += '&v-' + (new Date()).getTime();
+                               params += '&' + vaadin.getBrowserDetailsParameters(appId); 
                                
                                var r;
                                try {
                                                }
                                        }  
                                };
-                               r.send(null);
+                               // send parameters as POST data
+                               r.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+                               r.send(params);
                                
                                log('sending request to ', url);
                        };                      
                },
                getBrowserDetailsParameters: function(parentElementId) {
                        // Screen height and width
-                       var url = 'v-sh=' + window.screen.height;
-                       url += '&v-sw=' + window.screen.width;
+                       var params = 'v-sh=' + window.screen.height;
+                       params += '&v-sw=' + window.screen.width;
                        
                        // Window height and width
                        var cw = 0;
                                cw = document.documentElement.clientWidth;
                                ch = document.documentElement.clientHeight;
                        }
-                       url += '&v-cw=' + cw + '&v-ch=' + ch;
+                       params += '&v-cw=' + cw + '&v-ch=' + ch;
                        
 
                        var d = new Date();
                        
-                       url += '&v-curdate=' + d.getTime();
+                       params += '&v-curdate=' + d.getTime();
                        
                        var tzo1 = d.getTimezoneOffset(); // current offset
                        var dstDiff = 0;
                        }
 
                        // Time zone offset
-                       url += '&v-tzo=' + tzo1;
+                       params += '&v-tzo=' + tzo1;
                        
                        // DST difference
-                       url += '&v-dstd=' + dstDiff;
+                       params += '&v-dstd=' + dstDiff;
                        
                        // Raw time zone offset
-                       url += '&v-rtzo=' + rtzo;
+                       params += '&v-rtzo=' + rtzo;
                        
                        // DST in effect?
-                       url += '&v-dston=' + (tzo1 != rtzo);
+                       params += '&v-dston=' + (tzo1 != rtzo);
                        
                        var pe = document.getElementById(parentElementId);
                        if (pe) {
-                               url += '&v-vw=' + pe.offsetWidth;
-                               url += '&v-vh=' + pe.offsetHeight;
+                               params += '&v-vw=' + pe.offsetWidth;
+                               params += '&v-vh=' + pe.offsetHeight;
                        }
                        
                        // Location
-                       url += '&v-loc=' + encodeURIComponent(location.href);
+                       params += '&v-loc=' + encodeURIComponent(location.href);
 
                        // Window name
                        if (window.name) {
-                               url += '&v-wn=' + encodeURIComponent(window.name);
+                               params += '&v-wn=' + encodeURIComponent(window.name);
                        }
                        
                        // Detect touch device support
                        }
 
                        if (supportsTouch) {
-                               url += "&v-td=1";
+                               params += "&v-td=1";
                        }
                
-               return url;
+               return params;
                }
        };