Issue
I wanted to get the last part of the referrer URL. How would be the best way to obtain this information?
String referrer = request.getHeader("referer");
Currently this is how I am getting the referrer URL. This is giving me the entire URL, but I only want part of the URL.
For Example: Requested URL: http://localhost:8080/TEST/ABC.html
If this is the referrer URL, I only want the ABC.html
.
Thank you for the assistance, please let me know if there are any misunderstandings to my question.
Solution
This will give you XYZ.html :
String url = "http://localhost:8080/TEST/XYZ.html";
url = url.substring(url.lastIndexOf("/") + 1);
Answered By - VishalDevgire
Answer Checked By - Gilberto Lyons (JavaFixing Admin)