Skip to content

Commit

Permalink
Remove root redirect method
Browse files Browse the repository at this point in the history
Deleted the method that redirected from root endpoint to the greeting endpoint. Instead, visitors should see a landing page when accessing the base URL.
  • Loading branch information
jcardozo committed Sep 16, 2024
1 parent a794244 commit ee36c9e
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.RedirectView;

@RestController
public class GreetingController {

private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();

@GetMapping("/")
public RedirectView redirectFromRootToDefaultEndpoint() {
return new RedirectView("/greeting");
}

@GetMapping("/greeting")
public Greeting greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
return new Greeting(counter.incrementAndGet(), String.format(template, name));
Expand Down

0 comments on commit ee36c9e

Please sign in to comment.