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 5 years, 4 months ago.
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?
You can get the original URL from the PrettyContext like this:
String url = PrettyContext.getCurrentInstance().getRequestURL().toURL();
But it gives requested URL, I need current URL (i.e previous URL once the requested page called.).
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?
You must be logged in to reply to this topic.
Comments are closed.
If you find our tools useful, please consider making a donation to help us stay online and building software!