Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如前所述,我尝试使用Status Files以下代码:
Status Files
install(StatusPages) { statusFile(HttpStatusCode.NotFound, HttpStatusCode.Unauthorized, filePattern = "#.html") }
并将文件保存如下:
但是运行之后,我得到了标准的 404 错误,这意味着文件看不到,我需要添加一些东西,还是我将它们保存在错误的位置?
它看起来像statusFiles()a resolveResource(path),所以它正在查看:src/main/resources/并且为了使其理解/查看位于statusFiles文件夹内的resources文件夹,filePattern需要调整小 nit 以反映它,所以正确的代码是:
statusFiles()
resolveResource(path)
src/main/resources/
statusFiles
resources
filePattern
statusFile(HttpStatusCode.NotFound, HttpStatusCode.Unauthorized, filePattern = "statusFiles/#.html")