If a user goes to profile?id=20, using request.getPathInfo() just returns /profile. Is there a way to retrieve the whole URL with parameters?
The reason I need to know this is because I want to forward the user back to the exact same page they came from after invoking a command, for example a friend request command.
The query string is not part of the path info.
You need to get it by
HttpServletRequest#getQueryString().And then compose the new URL yourself based on the parts.
By the way, I don’t see why you would need it in a forward as the initial URL would remain the same. Perhaps you’re confusing it with redirect?