-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
25 display version number in web pages and sample client (#29)
* Displaying version client page * Displaying version in index page # Conflicts: # objectmorph-app/src/main/resources/public/client.html * Rebase rectification + home link
- Loading branch information
1 parent
33038eb
commit 170c0b3
Showing
6 changed files
with
148 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
spring: | ||
application: | ||
name: "objectmorph-app" | ||
name: "@project.name@" | ||
version: "@project.version@" | ||
description: "@project.description@" | ||
groupId: "@project.groupId@" | ||
artifactId: "@project.artifactId@" | ||
logging: | ||
level: | ||
root: INFO | ||
pattern: | ||
console: "[%level] %d{yyyy-MM-dd HH:mm:ss} - %logger{1.} - %msg%n" | ||
server: | ||
max-http-request-header-size: 65000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Objectmorph-Sample-Client</title> | ||
</head> | ||
<body> | ||
<h1>Objectmorph Sample Client</h1> | ||
<h3> | ||
This page executes client side code. | ||
</h3> | ||
<h4> | ||
<i>Executable locally.</i> | ||
</h4> | ||
<div align="center" > | ||
<textarea id="notepad" placeholder="drag and drop Java source code files here" cols="64" rows="16"></textarea> | ||
</div> | ||
</body> | ||
<script> | ||
var notepad = document.getElementById('notepad'); | ||
var files = []; | ||
function dropfile(file) { | ||
var reader = new FileReader(); | ||
reader.onload = function(e) { | ||
files.push(encodeURIComponent(e.target.result)); | ||
}; | ||
reader.readAsText(file, "UTF-8"); | ||
} | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Objectmorph-Sample-Client</title> | ||
<script type="text/javascript" src="version.js" ></script> | ||
</head> | ||
<body onload="getVersion()" > | ||
<a href = "/" >Home</a> | ||
<h1>Objectmorph Sample Client</h1> | ||
<h3>This page executes client side code.</h3> | ||
<h4> | ||
<i>Executable locally.</i> | ||
</h4> | ||
<div align="center"> | ||
<textarea id="notepad" placeholder="drag and drop Java source code files here" cols="64" rows="16" ></textarea> | ||
</div> | ||
</body> | ||
<footer > | ||
<div align="right" > | ||
<p align="right" > | ||
Version: <b><label id="paragraphVersion" ></label></b> | ||
</p> | ||
</div> | ||
</footer> | ||
<script> | ||
var notepad = document.getElementById('notepad'); | ||
var files = []; | ||
function dropfile(file) { | ||
var reader = new FileReader(); | ||
reader.onload = function(e) { | ||
files.push(encodeURIComponent(e.target.result)); | ||
}; | ||
reader.readAsText(file, "UTF-8"); | ||
} | ||
|
||
notepad.ondrop = function(e) { | ||
e.preventDefault(); | ||
e.dataTransfer.setData("text/plain","data set in dragstart"); | ||
for (const file of e.dataTransfer.files) { | ||
if (!file.name.includes(".java")) { | ||
continue; | ||
notepad.ondrop = function(e) { | ||
e.preventDefault(); | ||
e.dataTransfer.setData("text/plain","data set in dragstart"); | ||
for (const file of e.dataTransfer.files) { | ||
if (!file.name.includes(".java")) { | ||
continue; | ||
} | ||
dropfile(file); | ||
} | ||
dropfile(file); | ||
} | ||
setTimeout(() => { | ||
UserAction(files); | ||
}, 250); | ||
files = []; | ||
}; | ||
setTimeout(() => { | ||
UserAction(files); | ||
}, 250); | ||
files = []; | ||
}; | ||
|
||
function UserAction(file) { | ||
var xhttp = new XMLHttpRequest(); | ||
xhttp.onreadystatechange = function() { | ||
if (this.readyState == 4 && this.status == 200) { | ||
console.log(this.responseText); | ||
const winUrl = URL.createObjectURL( | ||
new Blob([this.responseText], { type: "text/html" }) | ||
); | ||
|
||
const win = window.open( | ||
winUrl, | ||
"win", | ||
`width=512,height=512` | ||
); | ||
} | ||
}; | ||
var url = location.protocol + '//' + location.host + "/html"; | ||
xhttp.open("POST", url, true); | ||
var data = new FormData(); | ||
data.append('sourceCode', file); | ||
xhttp.send(data); | ||
} | ||
</script> | ||
function UserAction(file) { | ||
var xhttp = new XMLHttpRequest(); | ||
xhttp.onreadystatechange = function() { | ||
if (this.readyState == 4) { | ||
if (this.status == 200) { | ||
console.log(this.responseText); | ||
const winUrl = URL.createObjectURL(new Blob([this.responseText], { type: "text/html" })); | ||
const win = window.open(winUrl, "win", `width=512,height=512`); | ||
} else { | ||
alert('Error: ' + this.status + " " + this.responseText); | ||
} | ||
}; | ||
} | ||
var url = location.protocol + '//' + location.host + "/html"; | ||
xhttp.open("POST", url, true); | ||
var data = new FormData(); | ||
data.append('sourceCode', file); | ||
xhttp.send(data); | ||
} | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Welcome to ObjectMorph Application</title> | ||
</head> | ||
<body> | ||
<h1>ObjectMorph application</h1> | ||
<div> | ||
<p> | ||
The HTML endpoint: <a href="/html" >HTML Renderer</a>. | ||
</p> | ||
<p> | ||
The Swagger page <a href="/swagger-ui/index.html" >here</a>. | ||
</p> | ||
<p> | ||
Access to the sample client <a href="/client.html" >here</a>. | ||
</p> | ||
</div> | ||
</body> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Welcome to ObjectMorph Application</title> | ||
<script type="text/javascript" src="version.js"></script> | ||
</head> | ||
<body onload="getVersion()" > | ||
<h1>ObjectMorph application <i>(Beta version)</i></h1> | ||
<div> | ||
<p> | ||
The HTML endpoint: <a href="/html">HTML Renderer</a>. | ||
</p> | ||
<p> | ||
The Swagger page <a href="/swagger-ui/index.html">here</a>. | ||
</p> | ||
<p> | ||
Access to the sample client <a href="/client.html">here</a>. | ||
</p> | ||
</div> | ||
</body> | ||
<footer> | ||
<div align="right"> | ||
<p align="right"> | ||
Version: <b><label id="paragraphVersion"></label></b> | ||
</p> | ||
</div> | ||
</footer> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function getVersion() { | ||
var xhttp = new XMLHttpRequest(); | ||
xhttp.onreadystatechange = function() { | ||
if (this.readyState == 4) { | ||
if (this.status == 200) { | ||
document.getElementById("paragraphVersion").outerText = this.responseText; | ||
} else { | ||
alert('Error: ' + this.status + " " + this.responseText); | ||
} | ||
} | ||
}; | ||
var url = location.protocol + '//' + location.host + "/version"; | ||
xhttp.open("GET", url, true); | ||
xhttp.send(null); | ||
} |