Fixed building of app URIs with a domain only.

This is a follow-up to the merged PR that allows a route to be set for an app that contains only the domain part, without a host. Building of URIs on getApplication(s) was adding a "." to the front of the domain when a host was not included. Also added a test to verify the correct behavior.