From 710e41ba6a4818f24b1b191df42c42492fab3d07 Mon Sep 17 00:00:00 2001 From: Leonid Date: Sun, 2 Feb 2025 01:45:12 +0300 Subject: [PATCH] Initial commit --- .gitignore | 38 ++++++ .idea/.gitignore | 8 ++ .idea/encodings.xml | 7 + .idea/misc.xml | 13 ++ .idea/uiDesigner.xml | 124 ++++++++++++++++++ .idea/vcs.xml | 6 + README.md | 0 pom.xml | 57 ++++++++ .../kashey/sweater/GreetingController.java | 24 ++++ .../sweater/ServingWebContentApplication.java | 12 ++ .../resources/templates/greeting.mustache | 10 ++ src/main/resources/templates/main.mustache | 5 + 12 files changed, 304 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/java/net/sytes/kashey/sweater/GreetingController.java create mode 100644 src/main/java/net/sytes/kashey/sweater/ServingWebContentApplication.java create mode 100644 src/main/resources/templates/greeting.mustache create mode 100644 src/main/resources/templates/main.mustache diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c3f3b0a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..023b939 --- /dev/null +++ b/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.1 + + + + net.kashey.sytes + sweater + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-mustache + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/net/sytes/kashey/sweater/GreetingController.java b/src/main/java/net/sytes/kashey/sweater/GreetingController.java new file mode 100644 index 0000000..b0fd094 --- /dev/null +++ b/src/main/java/net/sytes/kashey/sweater/GreetingController.java @@ -0,0 +1,24 @@ +package net.sytes.kashey.sweater; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Map; + +@Controller +public class GreetingController { + + @GetMapping("/greeting") + public String greeting(@RequestParam(name = "name", required = false, defaultValue = "World") String name, + Map model) { + model.put("name", name); + return "greeting"; + } + + @GetMapping() + public String root(Map model) { + model.put("some", "Hello from main!!!"); + return "main"; + } +} \ No newline at end of file diff --git a/src/main/java/net/sytes/kashey/sweater/ServingWebContentApplication.java b/src/main/java/net/sytes/kashey/sweater/ServingWebContentApplication.java new file mode 100644 index 0000000..8dfd728 --- /dev/null +++ b/src/main/java/net/sytes/kashey/sweater/ServingWebContentApplication.java @@ -0,0 +1,12 @@ +package net.sytes.kashey.sweater; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ServingWebContentApplication { + public static void main(String[] args) { + SpringApplication.run(ServingWebContentApplication.class, args); + } + +} \ No newline at end of file diff --git a/src/main/resources/templates/greeting.mustache b/src/main/resources/templates/greeting.mustache new file mode 100644 index 0000000..1d5b344 --- /dev/null +++ b/src/main/resources/templates/greeting.mustache @@ -0,0 +1,10 @@ + + + + Getting Started: Serving Web Content + + + +
Hello {{name}}!!!
+ + \ No newline at end of file diff --git a/src/main/resources/templates/main.mustache b/src/main/resources/templates/main.mustache new file mode 100644 index 0000000..60fc9df --- /dev/null +++ b/src/main/resources/templates/main.mustache @@ -0,0 +1,5 @@ + + +
{{some}}
+ + \ No newline at end of file