提升RewriteResponse找不到有效的网址 [英] Lift RewriteResponse not finding a valid url

查看:73
本文介绍了提升RewriteResponse找不到有效的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Lift和URL重写时遇到了一些麻烦.我写了一个简单的重写规则:

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)))
    }
}

因此,当我输入 http://localhost:8080/user/brian 时,我希望有一个电话放在我放置在webroot目录中的viewUser.html文件中. viewUser.html的标记非常简单:

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>

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

But instead of seeing viewUser I get an error:

在此服务器上找不到请求的URL/user/brian

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

如果我手动输入viewUser的URL: http://localhost:8080/user/brian 我收到相同的错误.

Also if I enter the URL of viewUser by hand: http://localhost:8080/user/brian I get the same error.

我对此一无所知,确实找到了类似的错误会通过SiteMap系统发生.

I am out of ideas on this one, I did find a similar error which happens through the SiteMap system.

我通过添加viewUser.html并添加了一小部分重写代码,对一个干净签出的lift-archetype-blank项目进行了尝试.

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.

推荐答案

确保已将"viewUser"添加到站点地图.如果不这样做,Lift不知道在哪里可以找到页面.

Make sure you've added "viewUser" to the site map. Without doing so Lift doesn't know where to find page.

这篇关于提升RewriteResponse找不到有效的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆