提升 RewriteResponse 未找到有效的 url
您好,我在 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,而是得到了一个错误:
在此服务器上找不到请求的 URL /user/brian
另外,如果我手动输入 viewUser 的 URL: http: //localhost:8080/user/brian 我得到同样的错误。
我对此一无所知,我确实发现了类似的错误 这是通过 SiteMap 系统进行的。
我通过添加 viewUser.html 并添加单个重写代码块,通过彻底检查的 lift-archetype-blank 项目尝试了此操作。
Hi I'm having some trouble with Lift and URL rewriting. I've written a simple rewrite rule:
LiftRules.rewrite.append {
case RewriteRequest(
ParsePath(List("user", userID), _, _, _), _, _) => {
println(userID)
RewriteResponse(List("viewUser"), Map("userID" -> urlDecode(userID)))
}
}
So when I enter http://localhost:8080/user/brian I expect a call to be made to the viewUser.html file I have placed in the webroot directory.
The mark up of viewUser.html is very simple:
<lift:surround with="default" at="content">
<p>ViewUser</p>
</lift:surround>
But instead of seeing viewUser I get an error:
The Requested URL /user/brian was not found on this server
Also if I enter the URL of viewUser by hand: http://localhost:8080/user/brian I get the same error.
I am out of ideas on this one, I did find a similar error which happens through the SiteMap system.
I've tried this with a cleanly checked out lift-archetype-blank project, by adding the viewUser.html and adding the single chunk of rewrite code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您已将“viewUser”添加到站点地图中。 如果不这样做,Lift 就不知道在哪里可以找到页面。
Make sure you've added "viewUser" to the site map. Without doing so Lift doesn't know where to find page.