【发布时间】:2014-06-28 06:41:02
【问题描述】:
我正在使用 Ocpsoft Rewrite 在 JSF 项目中执行 URL 重写。我有一个重定向规则,效果很好:
.addRule()
.when(Direction.isInbound().and(Path.matches("/venue/{id}")))
.perform(Redirect.temporary(context.getContextPath() +
"/protected/index.xhtml?venueID={id}"));
但是,由于重定向,这会更改导航栏中的 URL。我以为我可以改用 Join 规则,但它并没有像我预期的那样工作:
.addRule(Join.path("/venue/{venueID}").to("/protected/index.xhtml"))
.perform(Log.message(Level.INFO, "Rewrite is active!"));
我认为这条规则会从 foo/venue/123 重定向到 foo/protected/index.xhtml?venueID=123,但我没有将 ?venueID=... 参数附加到 URL。
有人知道正确的规则应该是什么样子吗?
【问题讨论】:
标签: jsf url-rewriting prettyfaces ocpsoft-rewrite