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 9 years, 2 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?
The forum ‘PrettyFaces Users’ is closed to new topics and replies.
Comments are closed.
If you find our tools useful, please consider making a donation to help us stay online and building software!