aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_http_service
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-10-03 10:03:30 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2017-10-03 10:03:30 +0200
commitff6567a79a08d80b48a3fa8d2fce19471bab2f9f (patch)
treef444f719bb90dd08fcd9bb08e3f1b68c63b5fcb9 /jdisc_http_service
parent81b9d23e0e85e73626ff6edea446741bb263b465 (diff)
Nonfunctional changes only
Diffstat (limited to 'jdisc_http_service')
-rw-r--r--jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java51
1 files changed, 21 insertions, 30 deletions
diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
index df029620181..41a0bee91b9 100644
--- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
+++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java
@@ -73,15 +73,12 @@ public class ConnectorFactory {
ConnectorConfig.Ssl ssl = config.ssl();
if (ssl.keyStoreType() == JKS) {
- if (! ssl.pemKeyStore().keyPath().isEmpty()
- || ! ssl.pemKeyStore().certificatePath().isEmpty())
- throw new IllegalArgumentException(
- "Setting pemKeyStore attributes does not make sense when keyStoreType==JKS.");
+ if (! ssl.pemKeyStore().keyPath().isEmpty() || ! ssl.pemKeyStore().certificatePath().isEmpty())
+ throw new IllegalArgumentException("pemKeyStore attributes can not be set when keyStoreType is JKS.");
}
if (ssl.keyStoreType() == PEM) {
if (! ssl.keyStorePath().isEmpty())
- throw new IllegalArgumentException(
- "Setting keyStorePath does not make sense when keyStoreType==PEM");
+ throw new IllegalArgumentException("keyStorePath can not be set when keyStoreType is PEM");
}
}
@@ -90,7 +87,7 @@ public class ConnectorFactory {
}
public ServerConnector createConnector(final Metric metric, final Server server, final ServerSocketChannel ch, Map<Path, FileChannel> keyStoreChannels) {
- final ServerConnector connector;
+ ServerConnector connector;
if (connectorConfig.ssl().enabled()) {
connector = new JDiscServerConnector(connectorConfig, metric, server, ch,
newSslConnectionFactory(keyStoreChannels),
@@ -115,7 +112,7 @@ public class ConnectorFactory {
}
private HttpConnectionFactory newHttpConnectionFactory() {
- final HttpConfiguration httpConfig = new HttpConfiguration();
+ HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSendDateHeader(true);
httpConfig.setSendServerVersion(false);
httpConfig.setSendXPoweredBy(false);
@@ -133,7 +130,7 @@ public class ConnectorFactory {
private SslConnectionFactory newSslConnectionFactory(Map<Path, FileChannel> keyStoreChannels) {
Ssl sslConfig = connectorConfig.ssl();
- final SslContextFactory factory = new SslContextFactory();
+ SslContextFactory factory = new SslContextFactory();
switch (sslConfig.clientAuth()) {
case NEED_AUTH:
factory.setNeedClientAuth(true);
@@ -148,21 +145,21 @@ public class ConnectorFactory {
}
if (!sslConfig.excludeProtocol().isEmpty()) {
- final String[] prots = new String[sslConfig.excludeProtocol().size()];
+ String[] prots = new String[sslConfig.excludeProtocol().size()];
for (int i = 0; i < prots.length; i++) {
prots[i] = sslConfig.excludeProtocol(i).name();
}
factory.setExcludeProtocols(prots);
}
if (!sslConfig.includeProtocol().isEmpty()) {
- final String[] prots = new String[sslConfig.includeProtocol().size()];
+ String[] prots = new String[sslConfig.includeProtocol().size()];
for (int i = 0; i < prots.length; i++) {
prots[i] = sslConfig.includeProtocol(i).name();
}
factory.setIncludeProtocols(prots);
}
if (!sslConfig.excludeCipherSuite().isEmpty()) {
- final String[] ciphs = new String[sslConfig.excludeCipherSuite().size()];
+ String[] ciphs = new String[sslConfig.excludeCipherSuite().size()];
for (int i = 0; i < ciphs.length; i++) {
ciphs[i] = sslConfig.excludeCipherSuite(i).name();
}
@@ -170,24 +167,23 @@ public class ConnectorFactory {
}
if (!sslConfig.includeCipherSuite().isEmpty()) {
- final String[] ciphs = new String[sslConfig.includeCipherSuite().size()];
+ String[] ciphs = new String[sslConfig.includeCipherSuite().size()];
for (int i = 0; i < ciphs.length; i++) {
ciphs[i] = sslConfig.includeCipherSuite(i).name();
}
factory.setIncludeCipherSuites(ciphs);
-
}
- Optional<String> password = Optional.of(sslConfig.keyDbKey()).
- filter(key -> !key.isEmpty()).map(secretStore::getSecret);
+ Optional<String> password = Optional.of(sslConfig.keyDbKey())
+ .filter(key -> !key.isEmpty())
+ .map(secretStore::getSecret);
switch (sslConfig.keyStoreType()) {
case PEM:
factory.setKeyStore(getKeyStore(sslConfig.pemKeyStore(), keyStoreChannels));
- if (password.isPresent()) {
+ if (password.isPresent())
log.warning("Encrypted PEM key stores are not supported.");
- }
break;
case JKS:
factory.setKeyStorePath(sslConfig.keyStorePath());
@@ -224,9 +220,7 @@ public class ConnectorFactory {
KeyStoreReaderForPath(String pathString) {
Path path = Paths.get(pathString);
channel = Optional.ofNullable(keyStoreChannels.get(path));
- readerForPath = new ReaderForPath(
- channel.map(this::getReader).orElseGet(() -> getReader(path)),
- path);
+ readerForPath = new ReaderForPath(channel.map(this::getReader).orElseGet(() -> getReader(path)), path);
}
private Reader getReader(FileChannel channel) {
@@ -275,12 +269,8 @@ public class ConnectorFactory {
private final boolean tcpNoDelay;
private final ServerSocketChannel channelOpenedByActivator;
- private JDiscServerConnector(
- final ConnectorConfig config,
- final Metric metric,
- final Server server,
- final ServerSocketChannel channelOpenedByActivator,
- final ConnectionFactory... factories) {
+ private JDiscServerConnector(ConnectorConfig config, Metric metric, Server server,
+ ServerSocketChannel channelOpenedByActivator, ConnectionFactory... factories) {
super(server, factories);
this.channelOpenedByActivator = channelOpenedByActivator;
this.tcpKeepAlive = config.tcpKeepAliveEnabled();
@@ -304,8 +294,7 @@ public class ConnectorFactory {
try {
socket.setKeepAlive(tcpKeepAlive);
socket.setTcpNoDelay(tcpNoDelay);
- } catch (final SocketException ignored) {
-
+ } catch (SocketException ignored) {
}
}
@@ -350,7 +339,8 @@ public class ConnectorFactory {
localPortField.set(this, localPort);
}
- private void uglySetChannel(ServerSocketChannel channelOpenedByActivator) throws NoSuchFieldException, IllegalAccessException {
+ private void uglySetChannel(ServerSocketChannel channelOpenedByActivator) throws NoSuchFieldException,
+ IllegalAccessException {
Field acceptChannelField = ServerConnector.class.getDeclaredField("_acceptChannel");
acceptChannelField.setAccessible(true);
acceptChannelField.set(this, channelOpenedByActivator);
@@ -364,4 +354,5 @@ public class ConnectorFactory {
return (JDiscServerConnector)request.getAttribute(REQUEST_ATTRIBUTE);
}
}
+
}