Lift RewriteResponse not finding a valid url

依然范特西╮ 提交于 2019-12-07 09:28:19

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/1219536/lift-rewriteresponse-not-finding-a-valid-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!