Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EJBCLIENT-205] Handle protocol property in jboss-ejb-client.properties #250

Merged
merged 1 commit into from
Apr 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public final class JBossEJBProperties implements Contextual<JBossEJBProperties>
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";

Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
}
Expand Down Expand Up @@ -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;
}

Expand Down