Dear Quarkus community,
I'm having a quick question: how to set / specify / what-to-implement in Quarkus to get a JSON based response for generic 404 cases? By default, an HTML based response is returned. For an API only service, that may not be acceptable.
This question addresses only the cases when a call is done to a non existent paths such as http://localhost:8080/some-wrong-path
.
Note: I'm not asking about to implement a ExceptionMapper<WebApplicationException>
or ContainerResponseFilter
. The wrong path/route cases are handled before these application provided implementations.
Thanks!
Expectations
Instead of getting an HTML based response like this:
<html>
<head>
<title>Error</title>
</head>
<body>Not Found</body>
</html>
I'd like to respond with in a JSON format, something like this:
{
"error": "Whatever error"
"details": "Potentially further details"
}