summaryrefslogtreecommitdiffstats
path: root/WebContent
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-10 00:42:54 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-11 10:16:37 +0000
commit6959b1f8b6bf2ba8ee39bb555ae7c9f0007d1d71 (patch)
treed6eca326a09cf05dbd1601fbd187e096871b6263 /WebContent
parentec4bf3aee70c311237ff443f372ff0bc95194b79 (diff)
downloadvaadin-framework-6959b1f8b6bf2ba8ee39bb555ae7c9f0007d1d71.tar.gz
vaadin-framework-6959b1f8b6bf2ba8ee39bb555ae7c9f0007d1d71.zip
Set character encoding before writing any response (#11501)
Change-Id: I2a319d2b970d5d0953ece3717af17057c32f2041
Diffstat (limited to 'WebContent')
-rw-r--r--WebContent/VAADIN/atmosphere.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/WebContent/VAADIN/atmosphere.min.js b/WebContent/VAADIN/atmosphere.min.js
index 2cd5e3fb26..54968f4721 100644
--- a/WebContent/VAADIN/atmosphere.min.js
+++ b/WebContent/VAADIN/atmosphere.min.js
@@ -9,4 +9,4 @@
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*/
-(function(){function l(a,b){var c,f,g=b.headers||{};if(b.readResponsesHeaders)for(c in b.lastTimestamp=(a.getResponseHeader("X-Cache-Date")||"").split(" ").pop(),b.uuid=(a.getResponseHeader("X-Atmosphere-tracking-id")||"").split(" ").pop(),g)(f=a.getResponseHeader(c))&&(g[c]=f)}function m(a,b){var c,f,g=b.headers||{};b.dropAtmosphereHeaders||(a.setRequestHeader("X-Atmosphere-Framework",n),a.setRequestHeader("X-Atmosphere-Transport",b.transport),a.setRequestHeader("X-Cache-Date",b.lastTimestamp||0), b.trackMessageLength&&a.setRequestHeader("X-Atmosphere-TrackMessageSize","true"),b.contentType&&a.setRequestHeader("Content-Type",b.contentType),a.setRequestHeader("X-Atmosphere-tracking-id",b.uuid));for(c in g)f=g[c],(f=portal.support.isFunction(f)?f.call(null,a,b):f)&&a.setRequestHeader(c,f)}var n="1.1",k={},p=portal.support.now();k.subscribe=function(a){a=new k.AtmosphereRequest(a);a.open();return a};k.unsubscribe=portal.finalize;k.AtmosphereRequest=function(a){var b,c;a=portal.support.extend({url:"", connectTimeout:-1,reconnectInterval:0,timeout:3E5,method:"GET",fallbackMethod:"GET",headers:{},maxRequest:-1,transport:"long-polling",fallbackTransport:"streaming",dispatchUrl:null,webSocketPathDelimiter:"@@",webSocketBinaryType:null,enableXDR:!1,rewriteURL:!1,attachHeadersAsQueryString:!0,withCredentials:!1,trackMessageLength:!1,messageDelimiter:"|",shared:!1,lastTimestamp:0,readResponsesHeaders:!0,dropAtmosphereHeaders:!0,contentType:"",uuid:0,executeCallbackBeforeReconnect:!1},a);this.open=function(){function f(){g(); j=setTimeout(function(){b.fire("close","idletimeout")},a.timeout)}function g(){clearTimeout(j)}function h(a){return{"long-polling":"longpoll",streaming:"stream",jsonp:"longpolljsonp",sse:"sse",websocket:"ws",session:"session",test:"test"}[a]}var j;b=portal.open(a.url,{atrequest:a,method:a.method,transports:[h(a.transport)],timeout:a.connectTimeout,credentials:a.withCredentials,sharing:a.shared,params:a.headers,longpollTest:!1,urlBuilder:function(b,d){if(!a.attachHeadersAsQueryString)return b;delete d.id; delete d.transport;delete d.heartbeat;delete d.lastEventId;portal.support.extend(d,{"X-Atmosphere-tracking-id":a.uuid,"X-Atmosphere-Framework":n,"X-Atmosphere-Transport":a.transport,"X-Cache-Date":a.lastTimestamp||0});a.trackMessageLength&&(d["X-Atmosphere-TrackMessageSize"]=!0);a.contentType&&(d["Content-Type"]=a.contentType);return b+(/\?/.test(b)?"&":"?")+portal.support.param(d)},reconnect:function(b,d){return-1===a.maxRequest||d<a.maxRequest?a.reconnectInterval:!1},xdrURL:a.enableXDR&&function(e){return(a.rewriteURL|| portal.defaults.xdrURL||function(){}).call(a.rewriteURL?window:b,e)||e},inbound:function(e){var d,c,j=[];0<a.timeout&&f();if(a.trackMessageLength){b.data("data")&&(e=b.data("data")+e);d=0;for(c=e.indexOf(a.messageDelimiter);-1!==c;){d=e.substring(d,c);e=e.substring(c+a.messageDelimiter.length,e.length);if(!e||e.length<d)break;c=e.indexOf(a.messageDelimiter);j.push(e.substring(0,d))}b.data("data",!j.length||-1!==c&&e&&d!==e.length?d+a.messageDelimiter+e:"")}else j.push(e);for(e=0;e<j.length;e++)j[e]= {type:"message",data:j[e]};return j},outbound:function(b){0<a.timeout&&f();return b.data},streamParser:function(a){return[a.replace(/^\s+/g,"")]},initIframe:function(a){var b;b=a.contentDocument||a.contentWindow.document;if(!b.body||!b.body.firstChild||"pre"!==b.body.firstChild.nodeName.toLowerCase())a=b.head||b.getElementsByTagName("head")[0]||b.documentElement||b,b=b.createElement("script"),b.text="document.write('<plaintext>')",a.insertBefore(b,a.firstChild),a.removeChild(b)}});b.on({connecting:function(){b.data("t1", {ws:"websocket",sse:"sse",streamxhr:"streaming",streamxdr:"streaming",streamiframe:"streaming",longpollajax:"long-polling",longpollxdr:"long-polling",longpolljsonp:"jsonp",session:"session",test:"test"}[b.data("transport")])},open:function(){var e={status:200,responseBody:"",headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};0<a.timeout&&(f(),b.one("close",g));if(c){if(e.state="re-opening",a.onReconnect)a.onReconnect(a,e)}else{e.state="opening";if(a.onOpen)a.onOpen(e); c=!0}a.callback&&a.callback(e)},message:function(c){var d={status:200,responseBody:c,headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};b.data("lastData",c);if(a.onMessage)a.onMessage(d);a.callback&&a.callback(d)},close:function(e){var d={status:200,responseBody:"",headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};switch(e){case "aborted":d.status=408;d.state="unsubscribe";break;case "done":case "timeout":d.status=!c?501:200;d.state="closed"; break;case "error":d.status=500;d.state="error";break;case "notransport":if(a.onTransportFailure)a.onTransportFailure(e,a);a.method=a.fallbackMethod;a.transport=a.fallbackTransport;b.option("method",a.method);b.option("transports",[h(a.transport)])}if("error"===e){if(a.onError)a.onError(d)}else if(a.onClose)a.onClose(d);a.callback&&a.callback(d);a.executeCallbackBeforeReconnect&&(b.fire("message",b.data("lastData")),b.option("method",a.method),b.option("transports",[h(a.transport)]))},waiting:function(){a.executeCallbackBeforeReconnect|| b.fire("message",b.data("lastData"))},session:function(c){if(c.from!==b.option("id")&&a.onLocalMessage)a.onLocalMessage(c.message)}})};this.push=function(a,c){var h=b.option("dispatchUrl");b.option("dispatchUrl",c);b.send("message",a);b.option("dispatchUrl",h)};this.pushLocal=function(a){b.broadcast("session",{from:b.option("id"),data:a})}};portal.support.extend(portal.transports,{ws:function(a,b){var c,f,g=window.WebSocket||window.MozWebSocket;if(g)return{feedback:!0,open:function(){var h=portal.support.getAbsoluteURL(a.data("url")).replace(/^http/, "ws");a.data("url",h);var hasBeenOpened=false;c=new g(h);b.atrequest.webSocketBinaryType&&(c.binaryType=b.atrequest.webSocketBinaryType);c.onopen=function(b){hasBeenOpened=true;a.data("event",b).fire("open")};c.onmessage=function(b){a.data("event",b)._fire(b.data)};c.onerror=function(b){a.data("event",b).fire("close",!hasBeenOpened?"notransport":f?"aborted":"error")};c.onclose=function(b){a.data("event",b).fire("close",!hasBeenOpened?"notransport":f?"aborted":b.wasClean?"done":"error")}},send:function(a){var f=b.atrequest.dispatchUrl,e=b.atrequest.webSocketPathDelimiter;console.log(b.atrequest); c.send((f?e+f+e:"")+a)},close:function(){f=!0;c.close()}}},httpbase:function(a,b){function c(){h.length?f(b.url+(b.dispatchUrl||""),h.shift()):g=!1}var f,g,h=[];f=!b.crossDomain||portal.support.corsable?function(a,e){var d=portal.support.xhr();d.onreadystatechange=function(){4===d.readyState&&(l(d,b.atrequest),c())};d.open("POST",a);m(d,b.atrequest);portal.support.corsable&&(d.withCredentials=b.credentials);d.send(e)}:window.XDomainRequest&&b.xdrURL&&b.xdrURL.call(a,"t")?function(f,e){var d=new window.XDomainRequest; d.onload=d.onerror=c;d.open("POST",b.xdrURL.call(a,f));d.send(e)}:function(a,b){var d=document.createElement("form");d.action=a;d.target="socket-"+ ++p;d.method="POST";d.enctype=d.encoding="text/plain";d.acceptCharset="UTF-8";d.style.display="none";d.innerHTML='<textarea name="data"></textarea><iframe name="'+d.target+'"></iframe>';d.firstChild.value=b;portal.support.on(d.lastChild,"load",function(){document.body.removeChild(d);c()});document.body.appendChild(d);d.submit()};return{send:function(a){h.push(a); g||(g=!0,c())}}},streamxhr:function(a,b){var c;if(!(portal.support.browser.msie&&10>+portal.support.browser.version||b.crossDomain&&!portal.support.corsable))return portal.support.extend(portal.transports.httpbase(a,b),{open:function(){var f;c=portal.support.xhr();c.onreadystatechange=function(){function g(){var b=a.data("index"),f=c.responseText.length;b?f>b&&a._fire(c.responseText.substring(b,f),!0):a.fire("open")._fire(c.responseText,!0);a.data("index",f)}2===c.readyState?l(c,b.atrequest):3=== c.readyState&&200===c.status?portal.support.browser.opera&&!f?f=portal.support.iterate(g):g():4===c.readyState&&(f&&f(),a.fire("close",200===c.status?"done":"error"))};c.open("GET",a.data("url"));portal.support.corsable&&(c.withCredentials=b.credentials);m(c,b.atrequest);c.send(null)},close:function(){c.abort()}})},longpollajax:function(a,b){var c,f,g=0;if(!b.crossDomain||portal.support.corsable)return portal.support.extend(portal.transports.httpbase(a,b),{open:function(){function h(){var j=a.buildURL(!g? "open":"poll",{count:++g});a.data("url",j);c=portal.support.xhr();c.onreadystatechange=function(){var e;!f&&4===c.readyState&&(200===c.status?(l(c,b.atrequest),(e=c.responseText)||1===g?(1===g&&a.fire("open"),e&&a._fire(e),h()):a.fire("close","done")):a.fire("close","error"))};c.open("GET",j);m(c,b.atrequest);portal.support.corsable&&(c.withCredentials=b.credentials);c.send(null)}b.longpollTest?h():setTimeout(function(){a.fire("open");h()},50)},close:function(){f=!0;c.abort()}})}});portal.support.on(window, "keypress",function(a){27===a.which&&a.preventDefault()});window.atmosphere=k})(); \ No newline at end of file
+(function(){function l(a,b){var c,f,g=b.headers||{};if(b.readResponsesHeaders)for(c in b.lastTimestamp=(a.getResponseHeader("X-Cache-Date")||"").split(" ").pop(),b.uuid=(a.getResponseHeader("X-Atmosphere-tracking-id")||"").split(" ").pop(),g)(f=a.getResponseHeader(c))&&(g[c]=f)}function m(a,b){var c,f,g=b.headers||{};b.dropAtmosphereHeaders||(a.setRequestHeader("X-Atmosphere-Framework",n),a.setRequestHeader("X-Atmosphere-Transport",b.transport),a.setRequestHeader("X-Cache-Date",b.lastTimestamp||0), b.trackMessageLength&&a.setRequestHeader("X-Atmosphere-TrackMessageSize","true"),a.setRequestHeader("X-Atmosphere-tracking-id",b.uuid));b.contentType&&a.setRequestHeader("Content-Type",b.contentType);for(c in g)f=g[c],(f=portal.support.isFunction(f)?f.call(null,a,b):f)&&a.setRequestHeader(c,f)}var n="1.1",k={},p=portal.support.now();k.subscribe=function(a){a=new k.AtmosphereRequest(a);a.open();return a};k.unsubscribe=portal.finalize;k.AtmosphereRequest=function(a){var b,c;a=portal.support.extend({url:"", connectTimeout:-1,reconnectInterval:0,timeout:3E5,method:"GET",fallbackMethod:"GET",headers:{},maxRequest:-1,transport:"long-polling",fallbackTransport:"streaming",dispatchUrl:null,webSocketPathDelimiter:"@@",webSocketBinaryType:null,enableXDR:!1,rewriteURL:!1,attachHeadersAsQueryString:!0,withCredentials:!1,trackMessageLength:!1,messageDelimiter:"|",shared:!1,lastTimestamp:0,readResponsesHeaders:!0,dropAtmosphereHeaders:!0,contentType:"",uuid:0,executeCallbackBeforeReconnect:!1},a);this.open=function(){function f(){g(); j=setTimeout(function(){b.fire("close","idletimeout")},a.timeout)}function g(){clearTimeout(j)}function h(a){return{"long-polling":"longpoll",streaming:"stream",jsonp:"longpolljsonp",sse:"sse",websocket:"ws",session:"session",test:"test"}[a]}var j;b=portal.open(a.url,{atrequest:a,method:a.method,transports:[h(a.transport)],timeout:a.connectTimeout,credentials:a.withCredentials,sharing:a.shared,params:a.headers,longpollTest:!1,urlBuilder:function(b,d){if(!a.attachHeadersAsQueryString)return b;delete d.id; delete d.transport;delete d.heartbeat;delete d.lastEventId;portal.support.extend(d,{"X-Atmosphere-tracking-id":a.uuid,"X-Atmosphere-Framework":n,"X-Atmosphere-Transport":a.transport,"X-Cache-Date":a.lastTimestamp||0});a.trackMessageLength&&(d["X-Atmosphere-TrackMessageSize"]=!0);a.contentType&&(d["Content-Type"]=a.contentType);return b+(/\?/.test(b)?"&":"?")+portal.support.param(d)},reconnect:function(b,d){return-1===a.maxRequest||d<a.maxRequest?a.reconnectInterval:!1},xdrURL:a.enableXDR&&function(e){return(a.rewriteURL|| portal.defaults.xdrURL||function(){}).call(a.rewriteURL?window:b,e)||e},inbound:function(e){var d,c,j=[];0<a.timeout&&f();if(a.trackMessageLength){b.data("data")&&(e=b.data("data")+e);d=0;for(c=e.indexOf(a.messageDelimiter);-1!==c;){d=e.substring(d,c);e=e.substring(c+a.messageDelimiter.length,e.length);if(!e||e.length<d)break;c=e.indexOf(a.messageDelimiter);j.push(e.substring(0,d))}b.data("data",!j.length||-1!==c&&e&&d!==e.length?d+a.messageDelimiter+e:"")}else j.push(e);for(e=0;e<j.length;e++)j[e]= {type:"message",data:j[e]};return j},outbound:function(b){0<a.timeout&&f();return b.data},streamParser:function(a){return[a.replace(/^\s+/g,"")]},initIframe:function(a){var b;b=a.contentDocument||a.contentWindow.document;if(!b.body||!b.body.firstChild||"pre"!==b.body.firstChild.nodeName.toLowerCase())a=b.head||b.getElementsByTagName("head")[0]||b.documentElement||b,b=b.createElement("script"),b.text="document.write('<plaintext>')",a.insertBefore(b,a.firstChild),a.removeChild(b)}});b.on({connecting:function(){b.data("t1", {ws:"websocket",sse:"sse",streamxhr:"streaming",streamxdr:"streaming",streamiframe:"streaming",longpollajax:"long-polling",longpollxdr:"long-polling",longpolljsonp:"jsonp",session:"session",test:"test"}[b.data("transport")])},open:function(){var e={status:200,responseBody:"",headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};0<a.timeout&&(f(),b.one("close",g));if(c){if(e.state="re-opening",a.onReconnect)a.onReconnect(a,e)}else{e.state="opening";if(a.onOpen)a.onOpen(e); c=!0}a.callback&&a.callback(e)},message:function(c){var d={status:200,responseBody:c,headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};b.data("lastData",c);if(a.onMessage)a.onMessage(d);a.callback&&a.callback(d)},close:function(e){var d={status:200,responseBody:"",headers:[],state:"messageReceived",transport:b.data("t1"),error:null,request:a};switch(e){case "aborted":d.status=408;d.state="unsubscribe";break;case "done":case "timeout":d.status=!c?501:200;d.state="closed"; break;case "error":d.status=500;d.state="error";break;case "notransport":if(a.onTransportFailure)a.onTransportFailure(e,a);a.method=a.fallbackMethod;a.transport=a.fallbackTransport;b.option("method",a.method);b.option("transports",[h(a.transport)])}if("error"===e){if(a.onError)a.onError(d)}else if(a.onClose)a.onClose(d);a.callback&&a.callback(d);a.executeCallbackBeforeReconnect&&(b.fire("message",b.data("lastData")),b.option("method",a.method),b.option("transports",[h(a.transport)]))},waiting:function(){a.executeCallbackBeforeReconnect|| b.fire("message",b.data("lastData"))},session:function(c){if(c.from!==b.option("id")&&a.onLocalMessage)a.onLocalMessage(c.message)}})};this.push=function(a,c){var h=b.option("dispatchUrl");b.option("dispatchUrl",c);b.send("message",a);b.option("dispatchUrl",h)};this.pushLocal=function(a){b.broadcast("session",{from:b.option("id"),data:a})}};portal.support.extend(portal.transports,{ws:function(a,b){var c,f,g=window.WebSocket||window.MozWebSocket;if(g)return{feedback:!0,open:function(){var h=portal.support.getAbsoluteURL(a.data("url")).replace(/^http/, "ws");a.data("url",h);var hasBeenOpened=false;c=new g(h);b.atrequest.webSocketBinaryType&&(c.binaryType=b.atrequest.webSocketBinaryType);c.onopen=function(b){hasBeenOpened=true;a.data("event",b).fire("open")};c.onmessage=function(b){a.data("event",b)._fire(b.data)};c.onerror=function(b){a.data("event",b).fire("close",!hasBeenOpened?"notransport":f?"aborted":"error")};c.onclose=function(b){a.data("event",b).fire("close",!hasBeenOpened?"notransport":f?"aborted":b.wasClean?"done":"error")}},send:function(a){var f=b.atrequest.dispatchUrl,e=b.atrequest.webSocketPathDelimiter;console.log(b.atrequest); c.send((f?e+f+e:"")+a)},close:function(){f=!0;c.close()}}},httpbase:function(a,b){function c(){h.length?f(b.url+(b.dispatchUrl||""),h.shift()):g=!1}var f,g,h=[];f=!b.crossDomain||portal.support.corsable?function(a,e){var d=portal.support.xhr();d.onreadystatechange=function(){4===d.readyState&&(l(d,b.atrequest),c())};d.open("POST",a);m(d,b.atrequest);portal.support.corsable&&(d.withCredentials=b.credentials);d.send(e)}:window.XDomainRequest&&b.xdrURL&&b.xdrURL.call(a,"t")?function(f,e){var d=new window.XDomainRequest; d.onload=d.onerror=c;d.open("POST",b.xdrURL.call(a,f));d.send(e)}:function(a,b){var d=document.createElement("form");d.action=a;d.target="socket-"+ ++p;d.method="POST";d.enctype=d.encoding="text/plain";d.acceptCharset="UTF-8";d.style.display="none";d.innerHTML='<textarea name="data"></textarea><iframe name="'+d.target+'"></iframe>';d.firstChild.value=b;portal.support.on(d.lastChild,"load",function(){document.body.removeChild(d);c()});document.body.appendChild(d);d.submit()};return{send:function(a){h.push(a); g||(g=!0,c())}}},streamxhr:function(a,b){var c;if(!(portal.support.browser.msie&&10>+portal.support.browser.version||b.crossDomain&&!portal.support.corsable))return portal.support.extend(portal.transports.httpbase(a,b),{open:function(){var f;c=portal.support.xhr();c.onreadystatechange=function(){function g(){var b=a.data("index"),f=c.responseText.length;b?f>b&&a._fire(c.responseText.substring(b,f),!0):a.fire("open")._fire(c.responseText,!0);a.data("index",f)}2===c.readyState?l(c,b.atrequest):3=== c.readyState&&200===c.status?portal.support.browser.opera&&!f?f=portal.support.iterate(g):g():4===c.readyState&&(f&&f(),a.fire("close",200===c.status?"done":"error"))};c.open("GET",a.data("url"));portal.support.corsable&&(c.withCredentials=b.credentials);m(c,b.atrequest);c.send(null)},close:function(){c.abort()}})},longpollajax:function(a,b){var c,f,g=0;if(!b.crossDomain||portal.support.corsable)return portal.support.extend(portal.transports.httpbase(a,b),{open:function(){function h(){var j=a.buildURL(!g? "open":"poll",{count:++g});a.data("url",j);c=portal.support.xhr();c.onreadystatechange=function(){var e;!f&&4===c.readyState&&(200===c.status?(l(c,b.atrequest),(e=c.responseText)||1===g?(1===g&&a.fire("open"),e&&a._fire(e),h()):a.fire("close","done")):a.fire("close","error"))};c.open("GET",j);m(c,b.atrequest);portal.support.corsable&&(c.withCredentials=b.credentials);c.send(null)}b.longpollTest?h():setTimeout(function(){a.fire("open");h()},50)},close:function(){f=!0;c.abort()}})}});portal.support.on(window, "keypress",function(a){27===a.which&&a.preventDefault()});window.atmosphere=k})(); \ No newline at end of file