diff options
Diffstat (limited to 'vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java')
-rw-r--r-- | vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java index 98aca13fff6..6a421370517 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java @@ -12,37 +12,12 @@ import java.net.URL; */ public final class Endpoint implements Serializable { - /** - * Creates an Endpoint with the default port and without using SSL. - * - * @param hostname the hostname - * @return an Endpoint instance - */ - public static Endpoint create(String hostname) { - return new Endpoint(hostname, DEFAULT_PORT, false); - } - - /** - * Creates an Endpoint with the given hostname, port and SSL setting. - * - * @param hostname the hostname - * @param port the port - * @param useSsl true if SSL is to be used - * @return an Endpoint instance - */ - public static Endpoint create(String hostname, int port, boolean useSsl) { - return new Endpoint(hostname, port, useSsl); - } - - public static Endpoint create(URL url) { - return new Endpoint(url.getHost(), url.getPort(), "https".equals(url.getProtocol())); - } + private static final int DEFAULT_PORT = 4080; - private static final long serialVersionUID = 4545345L; private final String hostname; private final int port; private final boolean useSsl; - private static final int DEFAULT_PORT = 4080; + private Endpoint(String hostname, int port, boolean useSsl) { if (hostname.startsWith("https://")) { throw new RuntimeException("Hostname should be name of machine, not prefixed with protocol (https://)"); @@ -90,4 +65,18 @@ public final class Endpoint implements Serializable { return result; } + /** Creates an Endpoint with the default port and without using SSL */ + public static Endpoint create(String hostname) { + return new Endpoint(hostname, DEFAULT_PORT, false); + } + + /** Creates an Endpoint with the given hostname, port and SSL setting. */ + public static Endpoint create(String hostname, int port, boolean useSsl) { + return new Endpoint(hostname, port, useSsl); + } + + public static Endpoint create(URL url) { + return new Endpoint(url.getHost(), url.getPort(), "https".equals(url.getProtocol())); + } + } |