Skip to content
Snippets Groups Projects
Commit 3981fbf4 authored by Sebastian Rieger's avatar Sebastian Rieger
Browse files

merged

parents eee35ca7 4daf5538
No related branches found
No related tags found
No related merge requests found
...@@ -14,9 +14,6 @@ public class TCPTimeCounterRESTService { ...@@ -14,9 +14,6 @@ public class TCPTimeCounterRESTService {
static final String bucketName = "vertsys-counter"; static final String bucketName = "vertsys-counter";
static final String bucketRegion = "eu-central-1"; static final String bucketRegion = "eu-central-1";
static final String dnsNameELB = "cloudcomp-loadbalancer-1492513132.eu-central-1.elb.amazonaws.com";
static final int portELBTarget = 36042;
private Long getCounter() { private Long getCounter() {
// Verbindung zu S3 // Verbindung zu S3
AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient(); AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
...@@ -41,8 +38,11 @@ public class TCPTimeCounterRESTService { ...@@ -41,8 +38,11 @@ public class TCPTimeCounterRESTService {
public String getCounterHtml() { public String getCounterHtml() {
return "<html><head><title>TCPTimeCounter REST Service</title>" + return "<html><head><title>TCPTimeCounter REST Service</title>" +
"<meta http-equiv=\"refresh\" content=\"5\"/></head><body>" + "<meta http-equiv=\"refresh\" content=\"5\"/></head><body>" +
"<h2>Cloud Computing HS Fulda - TCPTimeCounter REST Service</h2>"+ "<h2>HS Fulda - TCPTimeCounter REST Service</h2>"+
"<p><b>HTML-Output:</b> " + getCounter() + "</p></body></html>"; "<p><b>HTML-Output:</b> " + getCounter() + "</p></body>"+
"<form method=POST action=\"/counter\">" +
"<input type=\"hidden\" name=\"input\" value=\"1\">"+
"<input type=\"submit\" value=\"Increment\"></form></body></html>";
} }
@GET @GET
...@@ -68,12 +68,13 @@ public class TCPTimeCounterRESTService { ...@@ -68,12 +68,13 @@ public class TCPTimeCounterRESTService {
Long currentCounterValue = getCounter(); Long currentCounterValue = getCounter();
currentCounterValue = currentCounterValue + (new Long(input)).longValue(); currentCounterValue = currentCounterValue + (new Long(input)).longValue();
setCounter(currentCounterValue); setCounter(currentCounterValue);
return "<html><head><title>TCPTimeCounter REST Service</title></head></body>" + return "<html><head><title>TCPTimeCounter REST Service</title>" +
"<h2>Cloud Computing HS Fulda - TCPTimeCounter REST Service</h2>" + "<meta http-equiv=\"refresh\" content=\"5\"/></head><body>" +
"<p><b>HTML-Output:</b> counter increased by " + "<h2>HS Fulda - TCPTimeCounter REST Service</h2>"+
input + " to " + currentCounterValue + "</p>" + "<p><b>HTML-Output:</b> " + getCounter() + "</p></body>"+
"<form method=POST action=\"http://" + dnsNameELB + ":" + portELBTarget + webContextPath +"\">" + "<form method=POST action=\"/counter\">" +
"<input name=\"input\" value=\"\"></form></body></html>"; "<input type=\"hidden\" name=\"input\" value=\"1\">"+
"<input type=\"submit\" value=\"Increment\"></form></body></html>";
} }
@POST @POST
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment