有谁知道如何用覆盖现在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