/** * Sets the TCP port on which a listener accepts connections. * * @param type The connection type for which a listener is to be configured. * @param startInSslMode true when the listener to be configured is in legacy SSL mode, otherwise false. * @param port a port number. */ public void setPort( ConnectionType type, boolean startInSslMode, int port ) { getListener( type, startInSslMode ).setPort( port ); }
/** * Retrieves the configured TCP port on which a listener accepts connections. * * @param type The connection type for which a listener is to be configured. * @param startInSslMode true when the listener to be configured is in legacy SSL mode, otherwise false. * @return a port number. */ public int getPort( ConnectionType type, boolean startInSslMode ) { return getListener( type, startInSslMode ).getPort(); }
public NioSocketAcceptor getSocketAcceptor( ConnectionType type, boolean startInSslMode ) { return getListener( type, startInSslMode ).getSocketAcceptor(); }
/** * Return if the configuration allows this listener to be enabled (but does not verify that the listener is * indeed active) * * The #startInSslMode parameter is used to distinguish between listeners that expect to receive SSL encrypted data * immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to * StartTLS for in-band encryption configuration). When for a particular connection type only one of these options * is implemented, the parameter value is ignored. * * @param type The connection type for which a listener is to be configured. * @param startInSslMode true when the listener to be configured is in legacy SSL mode, otherwise false. * @return true if configuration allows this listener to be enabled, otherwise false. */ public boolean isEnabled( ConnectionType type, boolean startInSslMode ) { return getListener( type, startInSslMode ).isEnabled(); }
/** * Enables or disables a connection listener. Does nothing if the particular listener is already in the requested * state. * * The #startInSslMode parameter is used to distinguish between listeners that expect to receive SSL encrypted data * immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to * StartTLS for in-band encryption configuration). When for a particular connection type only one of these options * is implemented, the parameter value is ignored. * * @param type The connection type for which a listener is to be configured. * @param startInSslMode true when the listener to be configured is in legacy SSL mode, otherwise false. * @param enabled true if the listener is to be enabled, otherwise false. */ public void enable( ConnectionType type, boolean startInSslMode, boolean enabled ) { getListener( type, startInSslMode ).enable( enabled ); }
@Override public ConnectionConfiguration getConfiguration() { if (configuration == null) { final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); configuration = connectionManager.getListener( connectionType, true ).generateConnectionConfiguration(); } return configuration; }
@Override public ConnectionConfiguration getConfiguration() { // This is an ugly hack to get backwards compatibility with the pre-MINA era. As this implementation is being // removed (it is marked as deprecated - at the time of writing, it is only used for S2S). The ugly hack: assume // S2S: final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); return connectionManager.getListener( ConnectionType.SOCKET_S2S, false ).generateConnectionConfiguration(); }
@Override public ConnectionConfiguration getConfiguration() { // Here, a client-to-server configuration is mocked. It is likely not used, as actual connection handling takes // place at the connection manager. final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); return connectionManager.getListener( ConnectionType.SOCKET_C2S, true ).generateConnectionConfiguration(); }
@Override public ConnectionConfiguration getConfiguration() { if (configuration == null) { final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); configuration = connectionManager.getListener( connectionType, true ).generateConnectionConfiguration(); } return configuration; }
ConnectionListener getConnectionListener( ConnectionType type ) { ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); return connectionManager.getListener( type, getTLSPolicy().equals( Connection.TLSPolicy.legacyMode ) ); }
final TLSStreamHandler tlsStreamHandler = new TLSStreamHandler( socket, connectionManager.getListener( ConnectionType.SOCKET_S2S, directTLS ).generateConnectionConfiguration(), true );
private boolean isHttpCompressionEnabled() { final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.BOSH_C2S, true ).generateConnectionConfiguration(); return configuration.getCompressionPolicy() == null || configuration.getCompressionPolicy().equals( Connection.CompressionPolicy.optional ); }
private Connector createSSLConnector( final Server httpBindServer ) { final int securePort = getHttpBindSecurePort(); try { final IdentityStore identityStore = XMPPServer.getInstance().getCertificateStoreManager().getIdentityStore( ConnectionType.BOSH_C2S ); if (securePort > 0 && identityStore.getStore().aliases().hasMoreElements() ) { if ( !identityStore.containsDomainCertificate( ) ) { Log.warn("HTTP binding: Using certificates but they are not valid for the hosted domain"); } final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.BOSH_C2S, true ).generateConnectionConfiguration(); final SslContextFactory sslContextFactory = new EncryptionArtifactFactory(configuration).getSslContextFactory(); final HttpConfiguration httpsConfig = new HttpConfiguration(); httpsConfig.setSecureScheme("https"); httpsConfig.setSecurePort(securePort); configureProxiedConnector(httpsConfig); httpsConfig.addCustomizer(new SecureRequestCustomizer()); final ServerConnector sslConnector = new ServerConnector(httpBindServer, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig)); sslConnector.setHost(getBindInterface()); sslConnector.setPort(securePort); return sslConnector; } } catch (Exception e) { Log.error("Error creating SSL connector for Http bind", e); } return null; }
final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.WEBADMIN, true ).generateConnectionConfiguration(); final SslContextFactory sslContextFactory = new EncryptionArtifactFactory( configuration ).getSslContextFactory();
final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.SOCKET_C2S, false ).generateConnectionConfiguration();
/** * Retrieves the configured TCP port on which a listener accepts connections. * * @param type The connection type for which a listener is to be configured. * @param startInSslMode true when the listener to be configured is in legacy SSL mode, otherwise false. * @return a port number. */ public int getPort( ConnectionType type, boolean startInSslMode ) { return getListener( type, startInSslMode ).getPort(); }
@Override public ConnectionConfiguration getConfiguration() { if (configuration == null) { final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); configuration = connectionManager.getListener( connectionType, true ).generateConnectionConfiguration(); } return configuration; }
@Override public ConnectionConfiguration getConfiguration() { // This is an ugly hack to get backwards compatibility with the pre-MINA era. As this implementation is being // removed (it is marked as deprecated - at the time of writing, it is only used for S2S). The ugly hack: assume // S2S: final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); return connectionManager.getListener( ConnectionType.SOCKET_S2S, false ).generateConnectionConfiguration(); }
@Override public ConnectionConfiguration getConfiguration() { // Here, a client-to-server configuration is mocked. It is likely not used, as actual connection handling takes // place at the connection manager. final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); return connectionManager.getListener( ConnectionType.SOCKET_C2S, true ).generateConnectionConfiguration(); }
private boolean isHttpCompressionEnabled() { final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager()); final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.BOSH_C2S, true ).generateConnectionConfiguration(); return configuration.getCompressionPolicy() == null || configuration.getCompressionPolicy().equals( Connection.CompressionPolicy.optional ); }