gpt4 book ai didi

scala - 提升 RewriteResponse 未找到有效的 url

转载 作者:行者123 更新时间:2023-12-03 02:23:01 25 4
gpt4 key购买 nike

您好,我在 Lift 和 URL 重写方面遇到了一些问题。我写了一个简单的重写规则:

LiftRules.rewrite.append {
case RewriteRequest(
ParsePath(List("user", userID), _, _, _), _, _) => {
println(userID)
RewriteResponse(List("viewUser"), Map("userID" -> urlDecode(userID)))
}
}

所以当我输入http://localhost:8080/user/brian时我希望调用我放置在 webroot 目录中的 viewUser.html 文件。viewUser.html 的标记非常简单:

<lift:surround with="default" at="content">
<p>ViewUser</p>
</lift:surround>

但是我没有看到 viewUser,而是收到了一个错误:

The Requested URL /user/brian was not found on this server

此外,如果我手动输入 viewUser 的 URL:http://localhost:8080/user/brian我也遇到同样的错误。

我对此没有想法,我确实找到了类似的 error这是通过 SiteMap 系统进行的。

我已经通过添加 viewUser.html 并添加单个重写代码块,通过彻底检查的 lift-archetype-blank 项目尝试了此操作。

最佳答案

确保您已将“viewUser”添加到站点地图中。如果不这样做,Lift 就不知道在哪里可以找到页面。

关于scala - 提升 RewriteResponse 未找到有效的 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1219536/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com