forked from ipcrm/java_webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
48 lines (35 loc) · 1.01 KB
/
App.java
File metadata and controls
48 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.puppet.sample;
import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.Spark;
import java.util.HashMap;
import java.util.Map;
import static spark.Spark.get;
import static spark.Spark.before;
public class App
{
public String enMsg()
{
return "Hello World!";
}
private static String requestInfoToString(Request request) {
StringBuilder sb = new StringBuilder();
sb.append(request.requestMethod());
sb.append(" " + request.url());
sb.append(" " + request.body());
return sb.toString();
}
public static void main(String[] args) {
try {
Spark.port(Integer.parseInt(System.getProperty("appPort")));
} catch (Exception e) {
Spark.port(9999);
}
Spark.threadPool(10, 5, 600);
before((request, response) -> {
System.out.println(requestInfoToString(request));
});
get("/", (request,response) -> "Hello Shobhna! Puppet Pipelines and the Journey to Pervasive Automation. Hybridity. Containerism!");
}
}