You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2015/06/29 15:53:16 UTC
svn commit: r1688222 -
/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp
Author: degenaro
Date: Mon Jun 29 13:53:15 2015
New Revision: 1688222
URL: http://svn.apache.org/r1688222
Log:
UIMA-4488 DUCC Web Server (WS) file pager not working when data comprises "<" and ">"
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp?rev=1688222&r1=1688221&r2=1688222&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/file.pager.jsp Mon Jun 29 13:53:15 2015
@@ -103,6 +103,12 @@ under the License.
</div>
<script type="text/javascript">
+ String.prototype.startsWith = function(prefix) {
+ return this.indexOf(prefix) === 0;
+ }
+ String.prototype.endsWith = function(suffix) {
+ return this.indexOf(suffix, this.length - suffix.length) !== -1;
+ }
function ducc_init_log_file() {
var queryDict = {}
location.search.substr(1).split("&").forEach(function(item) {queryDict[item.split("=")[0]] = item.split("=")[1]})
@@ -115,9 +121,22 @@ under the License.
url : url,
success : function (data)
{
+ pre = "";
+ post = "";
+ if(data.startsWith("<pre>")) {
+ pre = "<pre>";
+ data = data.substring(5);
+ }
+ if(data.endsWith("</pre>\n")) {
+ post = "</pre>\n";
+ data = data.substring(0,data.length-7);
+ }
data = data.replace(/</g, "<");
- data = data.replace(/>/g, ">");
- $("#log_file_page_area").html(data);
+ data = data.replace(/>/g, ">");
+ if(data.length <= 0) {
+ data = "No data found.\n";
+ }
+ $("#log_file_page_area").html(pre+data+post);
}
});
}
@@ -137,9 +156,22 @@ under the License.
url : url,
success : function (data)
{
- data = data.replace(/</g, "<");
- data = data.replace(/>/g, ">");
- $("#log_file_page_area").html(data);
+ pre = "";
+ post = "";
+ if(data.startsWith("<pre>")) {
+ pre = "<pre>";
+ data = data.substring(5);
+ }
+ if(data.endsWith("</pre>\n")) {
+ post = "</pre>\n";
+ data = data.substring(0,data.length-7);
+ }
+ data = data.replace(/</g, "<");
+ data = data.replace(/>/g, ">");
+ if(data.length <= 0) {
+ data = "No data found.\n";
+ }
+ $("#log_file_page_area").html(pre+data+post);
}
});
}