Skip to content
Browse files

Fix issues with running IE 8

  • Loading branch information...
1 parent 7db2156 commit e2cf08b1605b9a06e56e5dc51ceac3efb95c32eb @rstoyanchev committed Aug 20, 2013
View
4 src/main/java/org/springframework/samples/portfolio/config/WebConfig.java
@@ -30,7 +30,6 @@
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
-import org.springframework.web.socket.sockjs.SockJsService;
import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService;
@@ -48,7 +47,8 @@
@Bean
public SimpleUrlHandlerMapping handlerMapping() {
- SockJsService sockJsService = new DefaultSockJsService(taskScheduler());
+ DefaultSockJsService sockJsService = new DefaultSockJsService(taskScheduler());
+ sockJsService.setDummySessionCookieEnabled(true);
HttpRequestHandler requestHandler = new SockJsHttpRequestHandler(sockJsService, webSocketHandler());
SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
View
8 src/main/webapp/assets/js/html5shiv.js
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
+for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
View
112 src/main/webapp/assets/js/stomp.js
@@ -1,14 +1,24 @@
-// Generated by CoffeeScript 1.4.0
+// Generated by CoffeeScript 1.6.3
+/*
+ Stomp Over WebSocket http://www.jmesnil.net/stomp-websocket/doc/ | Apache License V2.0
+
+ Copyright (C) 2010-2013 [Jeff Mesnil](http://jmesnil.net/)
+ Copyright (C) 2012 [FuseSource, Inc.](http://fusesource.com)
+*/
+
+
(function() {
var Byte, Client, Frame, Stomp,
- __hasProp = {}.hasOwnProperty;
+ __hasProp = {}.hasOwnProperty,
+ __slice = [].slice;
Byte = {
LF: '\x0A',
NULL: '\x00'
};
Frame = (function() {
+ var unmarshallSingle;
function Frame(command, headers, body) {
this.command = command;
@@ -32,18 +42,18 @@
return lines.join(Byte.LF);
};
- Frame._unmarshallSingle = function(data) {
- var body, chr, command, divider, headerLines, headers, i, idx, len, line, start, trim, _i, _j, _ref, _ref1;
+ unmarshallSingle = function(data) {
+ var body, chr, command, divider, headerLines, headers, i, idx, len, line, start, trim, _i, _j, _len, _ref, _ref1;
divider = data.search(RegExp("" + Byte.LF + Byte.LF));
headerLines = data.substring(0, divider).split(Byte.LF);
command = headerLines.shift();
headers = {};
trim = function(str) {
return str.replace(/^\s+|\s+$/g, '');
};
- line = idx = null;
- for (i = _i = 0, _ref = headerLines.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
- line = headerLines[i];
+ _ref = headerLines.reverse();
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ line = _ref[_i];
idx = line.indexOf(':');
headers[trim(line.substring(0, idx))] = trim(line.substring(idx + 1));
}
@@ -74,7 +84,7 @@
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
data = _ref[_i];
if ((data != null ? data.length : void 0) > 0) {
- _results.push(Frame._unmarshallSingle(data));
+ _results.push(unmarshallSingle(data));
}
}
return _results;
@@ -92,6 +102,7 @@
})();
Client = (function() {
+ var now;
function Client(ws) {
this.ws = ws;
@@ -102,16 +113,36 @@
outgoing: 10000,
incoming: 10000
};
+ this.maxWebSocketFrameSize = 16 * 1024;
this.subscriptions = {};
}
+ Client.prototype.debug = function(message) {
+ var _ref;
+ return typeof window !== "undefined" && window !== null ? (_ref = window.console) != null ? _ref.log(message) : void 0 : void 0;
+ };
+
+ now = function() {
+ return Date.now || new Date().valueOf;
+ };
+
Client.prototype._transmit = function(command, headers, body) {
var out;
out = Frame.marshall(command, headers, body);
if (typeof this.debug === "function") {
this.debug(">>> " + out);
}
- return this.ws.send(out);
+ while (true) {
+ if (out.length > this.maxWebSocketFrameSize) {
+ this.ws.send(out.substring(0, this.maxWebSocketFrameSize));
+ out = out.substring(this.maxWebSocketFrameSize);
+ if (typeof this.debug === "function") {
+ this.debug("remaining = " + out.length);
+ }
+ } else {
+ return this.ws.send(out);
+ }
+ }
};
Client.prototype._setupHeartbeat = function(headers) {
@@ -147,7 +178,7 @@
}
return this.ponger = typeof window !== "undefined" && window !== null ? window.setInterval(function() {
var delta;
- delta = Date.now() - _this.serverActivity;
+ delta = now() - _this.serverActivity;
if (delta > ttl * 2) {
if (typeof _this.debug === "function") {
_this.debug("did not receive server activity for the last " + delta + "ms");
@@ -158,9 +189,36 @@
}
};
- Client.prototype.connect = function(login, passcode, connectCallback, errorCallback, vhost) {
- var _this = this;
- this.connectCallback = connectCallback;
+ Client.prototype._parseConnect = function() {
+ var args, connectCallback, errorCallback, headers;
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ headers = {};
+ switch (args.length) {
+ case 2:
+ headers = args[0], connectCallback = args[1];
+ break;
+ case 3:
+ if (args[1] instanceof Function) {
+ headers = args[0], connectCallback = args[1], errorCallback = args[2];
+ } else {
+ headers.login = args[0], headers.passcode = args[1], connectCallback = args[2];
+ }
+ break;
+ case 4:
+ headers.login = args[0], headers.passcode = args[1], connectCallback = args[2], errorCallback = args[3];
+ break;
+ default:
+ headers.login = args[0], headers.passcode = args[1], connectCallback = args[2], errorCallback = args[3], headers.vhost = args[4];
+ }
+ return [headers, connectCallback, errorCallback];
+ };
+
+ Client.prototype.connect = function() {
+ var args, errorCallback, headers, out,
+ _this = this;
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = this._parseConnect.apply(this, args);
+ headers = out[0], this.connectCallback = out[1], errorCallback = out[2];
if (typeof this.debug === "function") {
this.debug("Opening Web Socket...");
}
@@ -175,7 +233,7 @@
}
return _results;
})()).join('')) : evt.data;
- _this.serverActivity = Date.now();
+ _this.serverActivity = now();
if (data === Byte.LF) {
if (typeof _this.debug === "function") {
_this.debug("<<< PONG");
@@ -199,8 +257,12 @@
_results.push(typeof _this.connectCallback === "function" ? _this.connectCallback(frame) : void 0);
break;
case "MESSAGE":
- onreceive = _this.subscriptions[frame.headers.subscription];
- _results.push(typeof onreceive === "function" ? onreceive(frame) : void 0);
+ onreceive = _this.subscriptions[frame.headers.subscription] || _this.onreceive;
+ if (onreceive) {
+ _results.push(onreceive(frame));
+ } else {
+ _results.push(typeof _this.debug === "function" ? _this.debug("Unhandled received MESSAGE: " + frame) : void 0);
+ }
break;
case "RECEIPT":
_results.push(typeof _this.onreceipt === "function" ? _this.onreceipt(frame) : void 0);
@@ -224,23 +286,11 @@
return typeof errorCallback === "function" ? errorCallback(msg) : void 0;
};
return this.ws.onopen = function() {
- var headers;
if (typeof _this.debug === "function") {
_this.debug('Web Socket Opened...');
}
- headers = {
- "accept-version": Stomp.VERSIONS.supportedVersions(),
- "heart-beat": [_this.heartbeat.outgoing, _this.heartbeat.incoming].join(',')
- };
- if (vhost) {
- headers.host = vhost;
- }
- if (login) {
- headers.login = login;
- }
- if (passcode) {
- headers.passcode = passcode;
- }
+ headers["accept-version"] = Stomp.VERSIONS.supportedVersions();
+ headers["heart-beat"] = [_this.heartbeat.outgoing, _this.heartbeat.incoming].join(',');
return _this._transmit("CONNECT", headers);
};
};
@@ -370,4 +420,4 @@
self.Stomp = Stomp;
}
-}).call(this);
+}).call(this);
View
5 src/main/webapp/index.html
@@ -6,6 +6,11 @@
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, max-age=0">
<link href="assets/css/portfolio.css" rel="stylesheet">
<link href="assets/css/bootstrap.css" rel="stylesheet">
+
+ <!--[if lt IE 9]>
+ <script src="assets/js/html5shiv.js"></script>
+ <![endif]-->
+
</head>
<body>
View
2 src/main/webapp/login.html
@@ -31,7 +31,7 @@ <h3 class="muted form-signin-heading">Please sign in</h3>
showErrorMessage : ko.computed(function() {
var query = window.location.search;
return query ? (query.indexOf('error') != -1) : false;
- }),
+ })
});
</script>

0 comments on commit e2cf08b

Please sign in to comment.
Something went wrong with that request. Please try again.