忽略漂亮脸模式中的大小写
如果您按如下方式定义了 url 映射:
@URLMapping(id = "myPage", pattern = "/myPage", viewId = "/faces/pages/myPage.xhtml")
如果您尝试将 url 输入为:
http:localhost:8080/myPage
这会正常工作,但如果您将大小写更改为:
http:localhost:8080/mypage
或 http:localhost:8080/MYPAGE
则不会工作,它不会找到页面,所以有没有办法忽略模式中的大小写,或者 PrettyFaces 还不支持这样的事情,如果不支持,那么请建议一个解决方法。
if you defined a url mapping as follows:
@URLMapping(id = "myPage", pattern = "/myPage", viewId = "/faces/pages/myPage.xhtml")
if you tried to enter the url as:
http:localhost:8080/myPage
this will work fine, but if you changed the case to:
http:localhost:8080/mypage
or http:localhost:8080/MYPAGE
it won't work, it won't find the page, so is there's a way to ignore the case in the pattern, or such thing is not supported in PrettyFaces yet, if not supported, then please suggest a workaround.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PrettyFaces 目前不直接支持类似的功能。但是您可以通过一个简单的解决方法来实现类似的效果:
将映射更改为完全小写的 URL:
然后添加执行小写转换的重写规则:
我认为这应该可以正常工作。您还可以尝试构建更通用的模式,这样您就不必为每个映射重复重写规则。
Something like this is currently not directly supported with PrettyFaces. But you could achieve something like this with a simple workaround:
Change your mapping to a completely lowercase URL:
And then add a rewrite rule that performs the lowercase transformation:
I think this should work fine. You could also try to build a more general pattern so that you don't have to repeat the rewrite rule for every mapping.