[NEXUS-7558] simple errors fix baseurl calculation

https://issues.sonatype.org/browse/NEXUS-7558

Encodes strings given to render error pages.

Aslo fixes baseUrl calculation which was messed up and not actually returning the proper base url when calculating from request.
Yup, probably need to understand implications of this a bit more.  Can't use sendError() here, but suppose it could be used after the template is rendered?