Search code examples
jerseyjettyhttp-status-code-404

where does 404 page of jetty locate at?


I built a restful service using jetty and jersey. When jersey return 404 response, jetty will return a 404 web page:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /test/404page. Reason:
<pre>    Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

But, I want nothing except for a 404 status code. I want to delete the default 404 page, but I can't found where does it locate at. What should I do?


Solution

  • What you need to do is set the following Jersey property to true

    ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR

    This will make it so that only the status code is sent, and not the error page.