What's the best way to get the current URL in Spring MVC?

Viewed 203025

I'd like to create URLs based on the URL used by the client for the active request. Is there anything smarter than taking the current HttpServletRequest object and it's getParameter...() methods to rebuilt the complete URL including (and only) it's GET parameters.

Clarification: If possible I want to resign from using a HttpServletRequest object.

7 Answers

System.out.println(((HttpServletRequest)request).getRequestURI());

I used it. hope it's useful.

Related