Repository: struts Updated Branches: refs/heads/master 856cb5fbe -> 6e6c4d8d6
WW-4823 Remove jQuery from debugging interceptor views Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/6e6c4d8d Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/6e6c4d8d Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/6e6c4d8d Branch: refs/heads/master Commit: 6e6c4d8d6522213c14f040e56ac21a5b9f400308 Parents: 856cb5f Author: Aleksandr Mashchenko <amashche...@apache.org> Authored: Thu Jul 20 20:48:56 2017 +0300 Committer: Aleksandr Mashchenko <amashche...@apache.org> Committed: Thu Jul 20 20:48:56 2017 +0300 ---------------------------------------------------------------------- .../struts2/interceptor/debugging/browser.ftl | 40 ++++++++++++-------- .../interceptor/debugging/webconsole.html | 11 +++--- .../struts2/interceptor/debugging/webconsole.js | 18 +++++++-- 3 files changed, 44 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/6e6c4d8d/core/src/main/resources/org/apache/struts2/interceptor/debugging/browser.ftl ---------------------------------------------------------------------- diff --git a/core/src/main/resources/org/apache/struts2/interceptor/debugging/browser.ftl b/core/src/main/resources/org/apache/struts2/interceptor/debugging/browser.ftl index 87175ce..8b1b3cb 100644 --- a/core/src/main/resources/org/apache/struts2/interceptor/debugging/browser.ftl +++ b/core/src/main/resources/org/apache/struts2/interceptor/debugging/browser.ftl @@ -54,7 +54,6 @@ } </style> - <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> function expand(src, path) { var baseUrl = location.href; @@ -62,24 +61,33 @@ baseUrl = (i > 0 ? baseUrl.substring(0, i) : baseUrl) + "&object=" + path; if (baseUrl.indexOf("decorate") < 0) { baseUrl += "&decorate=false"; - } - jQuery.get(baseUrl, function(data) { - var div = document.createElement("div"); - div.innerHTML = data; - src.parentNode.appendChild(div); - - src.innerHTML = "Collapse"; - var oldonclick = src.onclick; - src.onclick = function() { - src.innerHTML = "Expand"; - src.parentNode.removeChild(div); - src.onclick = oldonclick; - }; - }); + } + + var request = new XMLHttpRequest(); + request.open('GET', baseUrl, true); + request.onreadystatechange = function() { + if (this.readyState === 4) { + if (this.status >= 200 && this.status < 400) { + var div = document.createElement("div"); + console.log(this.responseText); + div.innerHTML = this.responseText; + src.parentNode.appendChild(div); + + src.innerHTML = "Collapse"; + var oldonclick = src.onclick; + src.onclick = function() { + src.innerHTML = "Expand"; + src.parentNode.removeChild(div); + src.onclick = oldonclick; + }; + } + } + }; + request.send(); } </script> <body> ${debugHtml} </body> -</html> \ No newline at end of file +</html> http://git-wip-us.apache.org/repos/asf/struts/blob/6e6c4d8d/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html ---------------------------------------------------------------------- diff --git a/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html b/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html index 9674c03..bb9e389 100644 --- a/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html +++ b/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.html @@ -24,18 +24,17 @@ <html> <head> <link rel="stylesheet" type="text/css" href="webconsole.css"/> - <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="webconsole.js"></script> <title>OGNL Console</title> </head> <body> <div id="shell"> + <div class="wc-results" id="wc-result"> + Welcome to the OGNL console! + <br/> + :-> + </div> <form onsubmit="return false" id="wc-form"> - <div class="wc-results" id="wc-result"> - Welcome to the OGNL console! - <br/> - :-> - </div> <input type="hidden" name="debug" value="command"/> <input name="expression" onkeyup="keyEvent(event)" class="wc-command" id="wc-command" type="text"/> </form> http://git-wip-us.apache.org/repos/asf/struts/blob/6e6c4d8d/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js ---------------------------------------------------------------------- diff --git a/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js b/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js index 2068e61..103c949 100644 --- a/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js +++ b/core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js @@ -48,9 +48,21 @@ function keyEvent(event, url) { commandsHistory[commandsHistory.length] = theShellCommand; historyPointer = commandsHistory.length; var theUrl = url ? url : window.opener.location.pathname; - jQuery.post(theUrl, jQuery("#wc-form").serialize(), function (data) { - printResult(data); - }); + + var request = new XMLHttpRequest(); + request.open('POST', theUrl, true); + request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + + request.onreadystatechange = function() { + if (this.readyState === 4) { + if (this.status >= 200 && this.status < 400) { + // Success! + printResult(this.responseText); + } + } + }; + + request.send("debug=command&expression="+encodeURIComponent(document.getElementById('wc-command').value)); } break; case 38: // this is the arrow up