Package org.java_websocket.server
Class DefaultSSLWebSocketServerFactory
- java.lang.Object
-
- org.java_websocket.server.DefaultSSLWebSocketServerFactory
-
- All Implemented Interfaces:
WebSocketFactory,WebSocketServerFactory
- Direct Known Subclasses:
CustomSSLWebSocketServerFactory
public class DefaultSSLWebSocketServerFactory extends Object implements WebSocketServerFactory
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutorServiceexecprotected SSLContextsslcontext
-
Constructor Summary
Constructors Constructor Description DefaultSSLWebSocketServerFactory(SSLContext sslContext)DefaultSSLWebSocketServerFactory(SSLContext sslContext, ExecutorService exec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Allows to shutdown the websocket factory for a clean shutdownWebSocketImplcreateWebSocket(WebSocketAdapter a, List<Draft> d)Create a new Websocket with the provided listener, drafts and socketWebSocketImplcreateWebSocket(WebSocketAdapter a, Draft d)Create a new Websocket with the provided listener, drafts and socketByteChannelwrapChannel(SocketChannel channel, SelectionKey key)Allows to wrap the Socketchannel( key.channel() ) to insert a protocol layer( like ssl or proxy authentication) beyond the ws layer.
-
-
-
Field Detail
-
sslcontext
protected SSLContext sslcontext
-
exec
protected ExecutorService exec
-
-
Constructor Detail
-
DefaultSSLWebSocketServerFactory
public DefaultSSLWebSocketServerFactory(SSLContext sslContext)
-
DefaultSSLWebSocketServerFactory
public DefaultSSLWebSocketServerFactory(SSLContext sslContext, ExecutorService exec)
-
-
Method Detail
-
wrapChannel
public ByteChannel wrapChannel(SocketChannel channel, SelectionKey key) throws IOException
Description copied from interface:WebSocketServerFactoryAllows to wrap the Socketchannel( key.channel() ) to insert a protocol layer( like ssl or proxy authentication) beyond the ws layer.- Specified by:
wrapChannelin interfaceWebSocketServerFactory- Parameters:
channel- The SocketChannel to wrapkey- a SelectionKey of an open SocketChannel.- Returns:
- The channel on which the read and write operations will be performed.
- Throws:
IOException- may be thrown while writing on the channel
-
createWebSocket
public WebSocketImpl createWebSocket(WebSocketAdapter a, Draft d)
Description copied from interface:WebSocketFactoryCreate a new Websocket with the provided listener, drafts and socket- Specified by:
createWebSocketin interfaceWebSocketFactory- Specified by:
createWebSocketin interfaceWebSocketServerFactory- Parameters:
a- The Listener for the WebsocketImpld- The draft which should be used- Returns:
- A WebsocketImpl
-
createWebSocket
public WebSocketImpl createWebSocket(WebSocketAdapter a, List<Draft> d)
Description copied from interface:WebSocketFactoryCreate a new Websocket with the provided listener, drafts and socket- Specified by:
createWebSocketin interfaceWebSocketFactory- Specified by:
createWebSocketin interfaceWebSocketServerFactory- Parameters:
a- The Listener for the WebsocketImpld- The drafts which should be used- Returns:
- A WebsocketImpl
-
close
public void close()
Description copied from interface:WebSocketServerFactoryAllows to shutdown the websocket factory for a clean shutdown- Specified by:
closein interfaceWebSocketServerFactory
-
-