mowwwalker
mowwwalker

Reputation: 17334

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

Upvotes: 10

Views: 25859

Answers (1)

Jon Lin
Jon Lin

Reputation: 143876

You want something like this?

String refererURI = new URI(request.getHeader("referer")).getPath();

Upvotes: 13

Related Questions