- Updated error response
This commit is contained in:
parent
b51250ffd3
commit
c80403a4f6
@ -1,6 +1,8 @@
|
||||
package de.w665.sharepulse.rest;
|
||||
|
||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -10,10 +12,19 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
public class ErrorRestController implements ErrorController {
|
||||
@RequestMapping("/error")
|
||||
public String handleError() {
|
||||
return "<script>" +
|
||||
public ResponseEntity<Object> handleError() {
|
||||
String script = "<script>" +
|
||||
"console.log('Page not found. Redirecting to /home...');" +
|
||||
"window.location.href = window.location.origin + '/home';" +
|
||||
"</script>";
|
||||
"</script>" +
|
||||
"<h1>You've reached the default error page.</h1>" +
|
||||
"<p>This could be caused by several reasons:</p>" +
|
||||
"<ul>" +
|
||||
"<li>The page you are looking for does not exist.</li>" +
|
||||
"<li>The page you are looking for is not accessible.</li>" +
|
||||
"<li>The page you are looking for is not available at the moment.</li>" +
|
||||
"<li>The page you are looking for is not accessible without authentication.</li>" +
|
||||
"</ul>";
|
||||
return new ResponseEntity<>(script, HttpStatus.FOUND);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user