LPS-37847 and LPS-37846

Resending. Please see the commit log of LPS-37847. I also wanted to fix this in PortalImpl but right now there is no easy way to do so since I cannot just modify the methods invoked from ViewAction.

The root problem is that we don't have a unified mechanism to create Portal URLs like we do for Portlet URLs. I'm trying to think about how we can introduce that but it wouldn't be easy and I would definitely not delay this fix for that.