JSF2和PrettyFaces ……如何获得原始URL或查询字符串?
PrettyFaces是一个简单的URL重写引擎。 各种各样的SEO是可能的,它真的很容易 。 我有一个小问题:(
使用漂亮的面孔,我有这个重写规则:
所以URL栏看起来像:
http://host.com/blog/first-post
并且重写规则将请求内部映射到:
http://host.com/blogEntry?shortUrl=first-post
我正在实现OpenID,这意味着我需要为OpenID提供程序提供返回URL。 但是,当我执行以下操作时:
originalUrl = Faces.getRequest().getRequestURL().toString()
我明白了:
http://host.com/blogEntry.jsf
getQueryString()返回一个空字符串
任何人都知道如何获得purty URL: http://host.com/blog/first-post
: shortUrl=first-post
或至少查询字符串shortUrl=first-post
您可以使用: PrettyContext.getCurrentInstance().getRequestUrl().toURL()
和PrettyContext.getCurrentInstance().getRequestQueryString().toQueryString()
类似论坛post: http : //ocpsoft.org/support/topic/how-get-the-original-request-uri-from-jsf