Here you can find the source of getUriByEndpoint(String endpoint)
private static URI getUriByEndpoint(String endpoint)
//package com.java2s; /*/* w ww .j ava 2 s . c om*/ * Copyright 2013-2016 Amazon Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://aws.amazon.com/apache2.0 * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES * OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and * limitations under the License. */ import java.net.URI; import java.net.URISyntaxException; public class Main { /** * Get the URI object for the given endpoint. URI class cannot correctly * parse the endpoint if it doesn't include protocol. This method will add * the protocol if this happens. */ private static URI getUriByEndpoint(String endpoint) { URI targetEndpointUri = null; try { targetEndpointUri = new URI(endpoint); if (targetEndpointUri.getHost() == null) { targetEndpointUri = new URI("http://" + endpoint); } } catch (URISyntaxException e) { throw new RuntimeException("Unable to parse service endpoint: " + e.getMessage()); } return targetEndpointUri; } }