From 26cbb51b481a7921dc296d0c0aa6cba196e30b60 Mon Sep 17 00:00:00 2001 From: Julian Horner <julianhorner@web.de> Date: Fri, 3 Jan 2020 13:55:51 +0100 Subject: [PATCH] Add controller package and minor improvements --- manifest.yml | 6 -- src/main/java/de/rtuni/ms/ds/Application.java | 6 +- .../ds/{ => controller}/HomeController.java | 84 ++++++++++--------- src/main/resources/application.yml | 11 +-- src/main/resources/templates/index.html | 2 +- 5 files changed, 50 insertions(+), 59 deletions(-) delete mode 100644 manifest.yml rename src/main/java/de/rtuni/ms/ds/{ => controller}/HomeController.java (63%) diff --git a/manifest.yml b/manifest.yml deleted file mode 100644 index af2459c..0000000 --- a/manifest.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -applications: -- buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git - host: dummy-service - name: dummy-service - memory: 64M \ No newline at end of file diff --git a/src/main/java/de/rtuni/ms/ds/Application.java b/src/main/java/de/rtuni/ms/ds/Application.java index 59f6bcd..d0aa494 100644 --- a/src/main/java/de/rtuni/ms/ds/Application.java +++ b/src/main/java/de/rtuni/ms/ds/Application.java @@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; /** - * Dummy service for microservice architecture. + * Class for starting dummy service. * * @author Julian * @@ -21,11 +21,11 @@ public class Application { //--------------------------------------------------------------------------------------------- /** - * Starts the application. + * Start the application. * * @param args The arguments */ - public static void main(final String[] args) { SpringApplication.run(Application.class, args); } + public static void main(String[] args) { SpringApplication.run(Application.class, args); } //--------------------------------------------------------------------------------------------- } diff --git a/src/main/java/de/rtuni/ms/ds/HomeController.java b/src/main/java/de/rtuni/ms/ds/controller/HomeController.java similarity index 63% rename from src/main/java/de/rtuni/ms/ds/HomeController.java rename to src/main/java/de/rtuni/ms/ds/controller/HomeController.java index 78e63c1..ca7550b 100644 --- a/src/main/java/de/rtuni/ms/ds/HomeController.java +++ b/src/main/java/de/rtuni/ms/ds/controller/HomeController.java @@ -1,42 +1,44 @@ -/* - * Copyright 2019 (C) by Julian Horner. - * All Rights Reserved. - */ - -package de.rtuni.ms.ds; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * Class that handles all kind of requests. - * - * @author Julian - * - */ -@Controller -public class HomeController { - //--------------------------------------------------------------------------------------------- - - /** - * Catches the request for the start page and returns the name of the corresponding template. - * - * @return The name of the template - */ - @RequestMapping("/") - public String index() { - return "index"; - } - - /** - * Catches the request for the secure page and returns the name of the corresponding template. - * - * @return The name of the template - */ - @RequestMapping("/securedPage") - public String securedPage() { - return "securedPage"; - } - - //--------------------------------------------------------------------------------------------- +/* + * Copyright 2019 (C) by Julian Horner. + * All Rights Reserved. + */ + +package de.rtuni.ms.ds.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Controller that handles all requests for the dummy service. + * + * @author Julian + * + */ +@Controller +public class HomeController { + //--------------------------------------------------------------------------------------------- + + /** + * Catch the request for the start page and return the name of the corresponding + * template. + * + * @return The name of the template to show + */ + @RequestMapping("/") + public String index() { + return "index"; + } + + /** + * Catch the request for the secure page and return the name of the corresponding + * template. + * + * @return The name of the template to show + */ + @RequestMapping("/securedPage") + public String securedPage() { + return "securedPage"; + } + + //--------------------------------------------------------------------------------------------- } \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1b7b187..a287557 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,15 +1,10 @@ -# Spring properties spring: application: - name: dummy-service # Identify this application + name: dummy-service # Identifier of this application -# Map the error path to error template (for Thymeleaf) -error.path: /error - -# HTTP Server -server.port: 3333 # HTTP (Tomcat) port +server.port: 3333 eureka: client: serviceUrl: - defaultZone: http://localhost:8761/eureka/ \ No newline at end of file + defaultZone: http://localhost:8761/eureka/ # URL of the eureka server for registration \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 9b26a72..32b6928 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -6,6 +6,6 @@ </head> <body> <h1>Page without authentication</h1> - <a href="#" th:href="@{/securedPage}">geschützte Seite anfordern</a> + <a href="#" th:href="@{/securedPage}">Request a secured page</a> </body> </html> \ No newline at end of file -- GitLab