-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes sabi-113 HTTP.500 after login (returned users)
- Loading branch information
1 parent
702c441
commit 6833250
Showing
26 changed files
with
470 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
sabi-webclient/src/main/java/de/bluewhale/sabi/webclient/config/AppConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
sabi-webclient/src/main/java/de/bluewhale/sabi/webclient/controller/MyErrorController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2024 by Stefan Schubert under the MIT License (MIT). | ||
* See project LICENSE file for the detailed terms and conditions. | ||
*/ | ||
|
||
package de.bluewhale.sabi.webclient.controller; | ||
|
||
import jakarta.servlet.RequestDispatcher; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.web.servlet.error.ErrorController; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
/** | ||
* Nice try (to solve sabi-113) but It won't work for <b>jakarta.faces.application.ViewExpiredException</b> | ||
* as the Controller will be involved in the Context of the DispatcherServlet, which won't happen for errors | ||
* occurring in the JSF engine. The error which has been seen by sabi-113 us happening | ||
* in the Context of the FacesServlet which gets uncaught all way up through the springframework.security.eb Filterchain. | ||
* <p> | ||
* So though this Error-Controller configuration is more or less dead code because of the | ||
* Faces Techstack here, I will leave it with this explanation as reference in it. | ||
*/ | ||
@Controller | ||
@Slf4j | ||
public class MyErrorController implements 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 "/static/error/404.html"; | ||
} else if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()) { | ||
return "/static/error/500.html"; | ||
} | ||
} | ||
|
||
return "/static/error/error.html"; // fallback | ||
} | ||
} |
Oops, something went wrong.