电梯代码Boot.scala
:
Menu.i("Topic") / "topic" >> If(() => false, "myerror")
从文件If
:
/**
* If the test returns True, the page can be accessed, otherwise,
* the result of FailMsg will be sent as a response to the browser.
* If the Loc cannot be accessed, it will not be displayed in menus.
*
* @param test -- the function that tests access to the page
* @param failMsg -- what to return the the browser (e.g., 304, etc.) if
* the page is accessed.
*/
case class If(test: () => Boolean, failMsg: FailMsg) extends AnyLocParam
它说:otherwise, the result of FailMsg will be sent as a response to the browser
。所以我希望它返回一个带有错误消息的 5xx 的 http 代码myerror
,但它不是,而是重定向到索引页面/
。
并带有卷曲:
➜ ~ curl http://localhost:8080/topic -I
HTTP/1.1 302 Found
Set-Cookie: JSESSIONID=5gqkx8azu8gh1u3avyjds3wl;Path=/
Location: /
Expires: Tue, 16 Jul 2013 05:18:02 GMT
Content-Length: 0
Cache-Control: no-cache, private, no-store
Content-Type: text/plain
Pragma: no-cache
Date: Tue, 16 Jul 2013 05:18:02 GMT
X-Lift-Version: 2.5
Server: Jetty(8.1.7.v20120910)
为什么它返回 302?我的错误信息在哪里myerror
?