-
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.
#1 - add controller and stub thymeleaf view
- Loading branch information
1 parent
7c3ea34
commit f1e2dac
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/systems/eventstream/field/controller/RootController.java
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,36 @@ | ||
package systems.eventstream.field.controller; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
@Controller | ||
public class RootController { | ||
|
||
@Value("${welcome.message}") | ||
private String message; | ||
|
||
private List<String> tasks = Arrays.asList("a", "b", "c", "d", "e", "f", "g"); | ||
|
||
@GetMapping("/") | ||
public String main(Model model) { | ||
model.addAttribute("message", message); | ||
model.addAttribute("tasks", tasks); | ||
|
||
return "welcome"; //view | ||
} | ||
|
||
// /hello?name=kotlin | ||
@GetMapping("/command") | ||
public String mainWithParam( | ||
@RequestParam(name = "name", required = false, defaultValue = "") | ||
String name, Model model) { | ||
model.addAttribute("message", name); | ||
return "welcome"; | ||
} | ||
} |
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 +1,4 @@ | ||
spring.security.user.name=user | ||
spring.security.user.password=password | ||
|
||
welcome.message=Event Stream |
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,28 @@ | ||
<!DOCTYPE HTML> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>Event Stream</title> | ||
<link rel="stylesheet" th:href="@{webjars/bootstrap/4.2.1/css/bootstrap.min.css}"/> | ||
<link rel="stylesheet" th:href="@{/css/main.css}"/> | ||
</head> | ||
<body> | ||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> | ||
<a class="navbar-brand" href="#">Event Stream</a> | ||
</nav> | ||
<main role="main" class="container"> | ||
<div class="starter-template"> | ||
<h1>Event Stream</h1> | ||
<h2> | ||
<span th:text="'Hello, ' + ${message}"></span> | ||
</h2> | ||
</div> | ||
<ol> | ||
<li th:each="task : ${tasks}" th:text="${task}"></li> | ||
</ol> | ||
</main> | ||
<!-- /.container --> | ||
<script type="text/javascript" th:src="@{webjars/bootstrap/4.2.1/js/bootstrap.min.js}"></script> | ||
</body> | ||
</html> |