Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #95 Create 404 Page #385

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/main/java/com/faforever/api/error/ErrorController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.faforever.api.error;

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;

@Controller
public class ErrorController implements org.springframework.boot.web.servlet.error.ErrorController {
@RequestMapping("/error")
public String handleError(HttpServletRequest request) {
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);

if (status != null) {
Integer statusCode = Integer.valueOf(status.toString());

if (statusCode == HttpStatus.NOT_FOUND.value()) {
return "404";
}
}
return "error";
}

@Override
public String getErrorPath() {
return "/error";
}
}
16 changes: 16 additions & 0 deletions src/main/resources/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Not Found</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" rel="stylesheet" type="text/css">
<link href="https://faforever.com/styles/css/site.min.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" th:href="@{/css/style.css}" type="text/css"/>
</head>
<body>
<div class="background hero"></div>
<h1 class="primary-color" style="position: fixed; top: 30%; left: 20%;">You will get what you have asked for.
Nothing...</h1>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we had something more like supreme commander information.

Like:

There is nothing left, commander.

Or

We couldn't find the page for you, commander.

Or:

Dostya: No vodka found in the trunk...

etc...

</body>
</html>
15 changes: 15 additions & 0 deletions src/main/resources/templates/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Not Found</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" rel="stylesheet" type="text/css">
<link href="https://faforever.com/styles/css/site.min.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" th:href="@{/css/style.css}" type="text/css"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: How does @{/css/style.css} works?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's some thymeleaf stuff

</head>
<body>
<div class="background hero"></div>
<h1 class="primary-color" style="position: fixed; top: 30%; left: 20%;">Oops... Something went wrong!</h1>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, more commander like stuff.

</body>
</html>