In case of a genuine missing resource, my API returns the following
{
"code": 404,
"message": "HTTP 404 Not Found"
}
When I return a 404 through my resource using the code Response.status(Response.Status.NOT_FOUND).build() I get the following HTML as response
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Error 404 Not Found</title>
</head>
<body>
<h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr>
<th>URI:</th>
<td>/v1/2/1/100</td>
</tr>
<tr>
<th>STATUS:</th>
<td>404</td>
</tr>
<tr>
<th>MESSAGE:</th>
<td>Not Found</td>
</tr>
<tr>
<th>SERVLET:</th>
<td>io.dropwizard.jersey.setup.JerseyServletContainer-21c99abf</td>
</tr>
</table>
</body>
</html>
I am trying to figure out how I can block this unintended HTML and respond with no data.