How to get client current URL?

Splash Forums PrettyFaces Users How to get client current URL?

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Kaltepoth 4 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18932

    Carolina
    Member

    Hi Pretty,

    I am using Pretty faces URL Rewriting.

    I need to know how to get current URL in my bean?

    If I use httpServletRequest.getRequestURL() is giving requested URL, but i need current URL where the request is generated?

    Any idea how to get client current URL?

    #23175

    You can get the original URL from the PrettyContext like this:

    String url = PrettyContext.getCurrentInstance().getRequestURL().toURL();

    #23176

    Carolina
    Member

    Thanks Christian,

    But it gives requested URL, I need current URL (i.e previous URL once the requested page called.).

    #23177

    I’m not sure if I understand your question. What do you mean with current URL?

    If you map /mypath to /faces/mypath.xhtml and access the page by entering /mypath in the browser, you will get /mypath when calling the code I posted before.

    What do you mean with previous URL? Something like the referrer header? Could you share some code?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.