Class SslFilter
- java.lang.Object
-
- org.glassfish.jersey.jdk.connector.internal.Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer>
-
- org.glassfish.jersey.jdk.connector.internal.SslFilter
-
class SslFilter extends Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
SslFilter.LazyBuffer
private static class
SslFilter.State
private class
SslFilter.WriteQueue
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
applicationInputBuffer
private javax.net.ssl.HostnameVerifier
customHostnameVerifier
private static java.nio.ByteBuffer
emptyBuffer
private java.nio.ByteBuffer
networkOutputBuffer
private java.lang.Runnable
pendingApplicationWrite
private java.lang.String
serverHost
private javax.net.ssl.SSLEngine
sslEngine
private SslFilter.State
state
private SslFilter.WriteQueue
writeQueue
-
Fields inherited from class org.glassfish.jersey.jdk.connector.internal.Filter
downstreamFilter, upstreamFilter
-
-
Constructor Summary
Constructors Constructor Description SslFilter(Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,?,?> downstreamFilter, javax.net.ssl.SSLContext sslContext, java.lang.String serverHost, javax.net.ssl.HostnameVerifier customHostnameVerifier)
SSL Filter constructor, takes upstream filter as a parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
close()
Close the filter, invokes close operation on the next filter in the filter chain.private boolean
doHandshakeStep(java.nio.ByteBuffer networkData)
private java.lang.String
getDebugState()
Returns a printed current state of the SslFilter that could be helpful for troubleshooting.private void
handleHandshakeFinished()
private void
handlePostWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
private boolean
handleRead(java.nio.ByteBuffer networkData)
private void
handleSslError(java.lang.Throwable t)
private void
handleWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
(package private) boolean
processRead(java.nio.ByteBuffer networkData)
ProcessFilter.onRead(Object)
.(package private) void
rehandshake()
Only for test.(package private) void
startSsl()
Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.private void
storePendingApplicationWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
(package private) void
write(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
Perform write operation for this filter and invokes write method on the next filter in the filter chain.-
Methods inherited from class org.glassfish.jersey.jdk.connector.internal.Filter
connect, handleConnect, onConnect, onConnectionClosed, onError, onRead, onSslHandshakeCompleted, processConnect, processConnectionClosed, processError, processSslHandshakeCompleted
-
-
-
-
Field Detail
-
emptyBuffer
private static final java.nio.ByteBuffer emptyBuffer
-
applicationInputBuffer
private final java.nio.ByteBuffer applicationInputBuffer
-
networkOutputBuffer
private final java.nio.ByteBuffer networkOutputBuffer
-
sslEngine
private final javax.net.ssl.SSLEngine sslEngine
-
customHostnameVerifier
private final javax.net.ssl.HostnameVerifier customHostnameVerifier
-
serverHost
private final java.lang.String serverHost
-
writeQueue
private final SslFilter.WriteQueue writeQueue
-
state
private volatile SslFilter.State state
-
pendingApplicationWrite
private java.lang.Runnable pendingApplicationWrite
-
-
Constructor Detail
-
SslFilter
SslFilter(Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,?,?> downstreamFilter, javax.net.ssl.SSLContext sslContext, java.lang.String serverHost, javax.net.ssl.HostnameVerifier customHostnameVerifier)
SSL Filter constructor, takes upstream filter as a parameter.- Parameters:
downstreamFilter
- a filter that is positioned under the SSL filter.sslContext
- configuration of SSL engine.serverHost
- server host (hostname or IP address), which will be used to verify authenticity of the server (the provided host will be compared against the host in the certificate provided by the server). IP address and hostname cannot be used interchangeably - if a certificate contains hostname and an IP address of the server is provided here, the verification will fail.customHostnameVerifier
- hostname verifier that will be used instead of the default one.
-
-
Method Detail
-
write
void write(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
Description copied from class:Filter
Perform write operation for this filter and invokes write method on the next filter in the filter chain.
-
handleWrite
private void handleWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
-
handlePostWrite
private void handlePostWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
-
storePendingApplicationWrite
private void storePendingApplicationWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
-
close
void close()
Description copied from class:Filter
Close the filter, invokes close operation on the next filter in the filter chain. The filter is expected to clean up any allocated resources and pass the invocation to downstream filter.
-
processRead
boolean processRead(java.nio.ByteBuffer networkData)
Description copied from class:Filter
ProcessFilter.onRead(Object)
.- Overrides:
processRead
in classFilter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer>
- Parameters:
networkData
- read data.- Returns:
true
if the data should be sent to processing to upper filter in the chain,false
otherwise.
-
handleRead
private boolean handleRead(java.nio.ByteBuffer networkData)
-
doHandshakeStep
private boolean doHandshakeStep(java.nio.ByteBuffer networkData)
-
handleHandshakeFinished
private void handleHandshakeFinished()
-
handleSslError
private void handleSslError(java.lang.Throwable t)
-
startSsl
void startSsl()
Description copied from class:Filter
Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.
-
rehandshake
void rehandshake()
Only for test.
-
getDebugState
private java.lang.String getDebugState()
Returns a printed current state of the SslFilter that could be helpful for troubleshooting.
-
-