I am building a simple Quarkus project.
I have a greeting resource class
public class GreetingResource {
String htmlString = "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>Title</title>\n" +
"</head>\n" +
"<body>\n" +
"Hello !\n" +
"</body>\n" +
"</html>";
@GET
@Produces(MediaType.TEXT_HTML)
public Response get() {
return Response.status(Response.Status.OK).entity(htmlString).build();
}
}
This code renders fine on a browser under localhost:8080/hello
.
However, when I change the response status code to BAD_REQUEST
, it just displays the raw htmlString
.
is there a way so that it renders properly with a 400 request? Eventually, I want to render the error myself using quarkus qute