9

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

tim_yates
  • 161,005
  • 26
  • 328
  • 327
mowwwalker
  • 15,446
  • 25
  • 95
  • 152

1 Answers1

12

You want something like this?

String refererURI = new URI(request.getHeader("referer")).getPath();
Jon Lin
  • 139,544
  • 27
  • 213
  • 216