diff --git a/src/main/java/org/jboss/ejb/client/legacy/CommonLegacyConfiguration.java b/src/main/java/org/jboss/ejb/client/legacy/CommonLegacyConfiguration.java index db5c7fda4..ec98ba72b 100644 --- a/src/main/java/org/jboss/ejb/client/legacy/CommonLegacyConfiguration.java +++ b/src/main/java/org/jboss/ejb/client/legacy/CommonLegacyConfiguration.java @@ -41,14 +41,19 @@ static URI getUri(final JBossEJBProperties.ConnectionConfiguration connectionCon if (port == -1) { return null; } - final String protocol; - if (connectionOptions.get(Options.SECURE, false) && connectionOptions.get(Options.SSL_ENABLED, false)) { - protocol = "remote+https"; + final String scheme; + final String protocol = connectionConfiguration.getProtocol(); + if (protocol == null) { + if (connectionOptions.get(Options.SECURE, false) && connectionOptions.get(Options.SSL_ENABLED, false)) { + scheme = "remote+https"; + } else { + scheme = "remote+http"; + } } else { - protocol = "remote+http"; + scheme = protocol; } try { - return new URI(protocol, null, NetworkUtil.formatPossibleIpv6Address(host), port, null, null, null); + return new URI(scheme, null, NetworkUtil.formatPossibleIpv6Address(host), port, null, null, null); } catch (URISyntaxException e) { return null; } diff --git a/src/main/java/org/jboss/ejb/client/legacy/JBossEJBProperties.java b/src/main/java/org/jboss/ejb/client/legacy/JBossEJBProperties.java index 6102a8eb8..bfc6ebbd3 100644 --- a/src/main/java/org/jboss/ejb/client/legacy/JBossEJBProperties.java +++ b/src/main/java/org/jboss/ejb/client/legacy/JBossEJBProperties.java @@ -100,6 +100,7 @@ public final class JBossEJBProperties implements Contextual private static final String PROPERTY_KEY_USERNAME = "username"; private static final String PROPERTY_KEY_PASSWORD = "password"; private static final String PROPERTY_KEY_PASSWORD_BASE64 = "password.base64"; + private static final String PROPERTY_KEY_PROTOCOL = "protocol"; private static final String PROPERTY_KEY_REALM = "realm"; private static final String PROPERTY_KEY_CALLBACK_HANDLER_CLASS = "callback.handler.class"; @@ -648,11 +649,13 @@ public static class ConnectionConfiguration extends CommonSubconfiguration { private final String host; private final int port; + private final String protocol; ConnectionConfiguration(Builder builder) { super(builder); this.host = builder.host; this.port = builder.port; + this.protocol = builder.protocol; } public String getHost() { @@ -662,10 +665,15 @@ public String getHost() { public int getPort() { return port; } - + + public String getProtocol() { + return protocol; + } + static final class Builder extends CommonSubconfiguration.Builder { String host; int port; + String protocol; Builder() { } @@ -700,6 +708,9 @@ boolean populateFromProperties(final Properties properties, final String prefix, return false; } setPort(port); + + String protocol = getProperty(properties, prefix + "protocol", DEFAULT_PROTOCOL, true).trim(); + this.protocol = protocol; return true; }