4

PrettyFaces is a dead simple URL rewriting engine. All sorts of SEO is possible and it is really really easy. I have one small problem though :(

Using pretty faces, I have this rewrite rule:

<url-mapping id="blogEntry">
    <pattern value="/blog/#{shortUrl}" />
    <view-id value="/blogEntry.jsf" />
</url-mapping>

So the URL bar looks like:

http://host.com/blog/first-post

And the rewrite rule maps the request internally to:

http://host.com/blogEntry?shortUrl=first-post

I'm implementing OpenID, which means I need to give the OpenID provider a return-to URL. However, when I do the following:

originalUrl = Faces.getRequest().getRequestURL().toString()

I get:

http://host.com/blogEntry.jsf

getQueryString() returns an empty string

Anyone know of way to either get the purty URL: http://host.com/blog/first-post or at minimum the query string shortUrl=first-post

Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84

1 Answers1

7

You can use: PrettyContext.getCurrentInstance().getRequestUrl().toURL() and PrettyContext.getCurrentInstance().getRequestQueryString().toQueryString()

Similar forum post: http://ocpsoft.org/support/topic/how-get-the-original-request-uri-from-jsf

Lincoln
  • 3,151
  • 17
  • 22