Add ability to set attributes on a SslContext (#9654)

Motivation:

Sometimes it is useful to be able to set attributes on a SslContext.

Modifications:

Add new method that will return a AttributeMap that is tied to a SslContext instance

Result:

Fixes https://github.com/netty/netty/issues/6542.
This commit is contained in:
Norman Maurer 2019-10-22 06:39:43 -07:00 committed by GitHub
parent 9bf10f2dc5
commit 247a4db470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,8 @@ import io.netty.channel.ChannelPipeline;
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol;
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior;
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior;
import io.netty.util.AttributeMap;
import io.netty.util.DefaultAttributeMap;
import io.netty.util.internal.EmptyArrays;
import java.security.Provider;
@ -97,6 +99,7 @@ public abstract class SslContext {
}
private final boolean startTls;
private final AttributeMap attributes = new DefaultAttributeMap();
/**
* Returns the default server-side implementation provider currently in use.
@ -862,6 +865,13 @@ public abstract class SslContext {
this.startTls = startTls;
}
/**
* Returns the {@link AttributeMap} that belongs to this {@link SslContext} .
*/
public final AttributeMap attributes() {
return attributes;
}
/**
* Returns {@code true} if and only if this context is for server-side.
*/