有誰知道如何用覆蓋現在404錯誤頁面使用時Spark微網框架?SparkJava自定義錯誤頁面
的默認錯誤頁面是:
<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 /strangepage. Reason:
<pre> Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
我想編輯該定製錯誤頁面(或者它重定向到另一個路線):如果部署
get(new Route("/404") {
@Override
public Object handle(Request request, Response response) {
response.type("text/html");
return "Error page 404";
}
});
問題'公共目錄'。由於公共目錄(它引發Jetty 404錯誤頁面),所以過濾每個url路徑是不可能的。 – dns