Updated typo in Java code and added a better way of detecting the host and URI scheme for the API.