Skip to content
Snippets Groups Projects
Commit 26cbb51b authored by Julian Horner's avatar Julian Horner
Browse files

Add controller package and minor improvements

parent 768ebb47
No related branches found
No related tags found
No related merge requests found
---
applications:
- buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git
host: dummy-service
name: dummy-service
memory: 64M
\ No newline at end of file
......@@ -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); }
//---------------------------------------------------------------------------------------------
}
/*
* 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
# 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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment