summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-10 16:34:47 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-10 16:34:47 +0000
commit6f74207c87e3315e68ed2b3091181f6e84c31a31 (patch)
tree2b941065ae5c94775cb6f3590b9a0d3e691ae8ed /src
Initial commit of basic listener
Diffstat (limited to 'src')
-rw-r--r--src/main/java/uk/co/blatech/blaears/Application.java12
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/IndexController.java15
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java20
-rw-r--r--src/main/resources/templates/index.vm10
4 files changed, 57 insertions, 0 deletions
diff --git a/src/main/java/uk/co/blatech/blaears/Application.java b/src/main/java/uk/co/blatech/blaears/Application.java
new file mode 100644
index 0000000..7c21af9
--- /dev/null
+++ b/src/main/java/uk/co/blatech/blaears/Application.java
@@ -0,0 +1,12 @@
+package uk.co.blatech.blaears;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/IndexController.java b/src/main/java/uk/co/blatech/blaears/controllers/IndexController.java
new file mode 100644
index 0000000..1bcfab0
--- /dev/null
+++ b/src/main/java/uk/co/blatech/blaears/controllers/IndexController.java
@@ -0,0 +1,15 @@
+package uk.co.blatech.blaears.controllers;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+public class IndexController {
+ @RequestMapping("/")
+ String index(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model){
+ model.addAttribute("name", name);
+ return "index";
+ }
+} \ No newline at end of file
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java b/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java
new file mode 100644
index 0000000..a89b47c
--- /dev/null
+++ b/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java
@@ -0,0 +1,20 @@
+package uk.co.blatech.blaears.controllers;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.io.IOException;
+
+@Controller
+public class MsgRelayController {
+ @RequestMapping("/msgrelay")
+ void relay(@RequestParam(value="text", required=true) String text){
+ try {
+ Runtime.getRuntime().exec("echo theblueroom test | ./msgrelay.bash " + text);
+ } catch (IOException e) {
+ System.out.println("Failed to run command echo theblueroom test | ./msgrelay.bash " + text);
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/templates/index.vm b/src/main/resources/templates/index.vm
new file mode 100644
index 0000000..a5a8d27
--- /dev/null
+++ b/src/main/resources/templates/index.vm
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+Hello $name
+</body>
+</html> \ No newline at end of file