Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java get referer URI?

I want the exact same method as getRequestURI(), but I want to use it on the referer. Is this possible?

I would like to turn http://www.example.com/my/path?vars=true into /my/path

like image 367
mowwwalker Avatar asked Aug 16 '12 22:08

mowwwalker


1 Answers

You want something like this?

String refererURI = new URI(request.getHeader("referer")).getPath();
like image 110
Jon Lin Avatar answered Oct 14 '22 03:10

Jon Lin