Skip to content

Commit

Permalink
Fix issue #6. Add code to show client and server information on their
Browse files Browse the repository at this point in the history
page.
  • Loading branch information
k-tamura committed Aug 29, 2017
1 parent f0808cc commit 1098b6e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.t246osslab.easybuggy4sb.controller;

import java.io.IOException;
import java.util.Properties;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ServerInfoController {

@RequestMapping(value = "/serverinfo")
public void serverinfo(HttpServletResponse res) throws IOException {
Properties properties = System.getProperties();
for (Object key : properties.keySet()) {
Object value = properties.get(key);
res.getWriter().write("<tr><td>" + key + "</td><td>" + value + "</td></tr>");
}
}
}
18 changes: 17 additions & 1 deletion src/main/webapp/uid/clientinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ <h2>
</tr>
</table>
<hr style="margin-top: 0px" />
<p>TODO: Under Constructing</p>
<p>Your browser information</p>
<script type="text/javascript">
<!--
document.write('<table class="table table-striped table-bordered table-hover" style="font-size: small;">');
document.write('<tr><td>Code</td><td>' + navigator.appCodeName + '</td></tr>');
document.write('<tr><td>Browser</td><td>' + navigator.appName + '</td></tr>');
document.write('<tr><td>Version</td><td>' + navigator.appVersion + '</td></tr>');
document.write('<tr><td>Platform</td><td>' + navigator.platform + '</td></tr>');
document.write('<tr><td>User Agent</td><td>' + navigator.userAgent + '</td></tr>');
if(document.all){
document.write('<tr><td>Language</td><td>' + navigator.browserLanguage + '</td></tr>');
} else {
document.write('<tr><td>Language</td><td>' + navigator.language + '</td></tr>');
}
document.write('</table>');
// -->
</script>
</body>
</html>
20 changes: 18 additions & 2 deletions src/main/webapp/uid/serverinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@ <h2>
</tr>
</table>
<hr style="margin-top: 0px" />
<p>TODO: Under Constructing</p>
<p>This is administrator page that cannot access general users.</p>
<table style="width: 720px;"
class="table table-striped table-bordered table-hover"
style="font-size:small;">
<tr>
<th>key</th>
<th>value</th>
</tr>
<script type="text/javascript">
<!--
var serverInfo = $.ajax({
type: "GET",
url: "../serverinfo",
async: false
}).responseText;
document.write(serverInfo);
// -->
</script>
</table>
</body>
</html>

0 comments on commit 1098b6e

Please sign in to comment.