Here is the code to use to retrieve the current URL in a controller.
Example with a news detail page :