当前位置: 首页>>代码示例>>Java>>正文


Java LocalClientSession.isAllowed方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.session.LocalClientSession.isAllowed方法的典型用法代码示例。如果您正苦于以下问题:Java LocalClientSession.isAllowed方法的具体用法?Java LocalClientSession.isAllowed怎么用?Java LocalClientSession.isAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.session.LocalClientSession的用法示例。


在下文中一共展示了LocalClientSession.isAllowed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createClientSession

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Creates a new client session that was established to the specified connection manager.
 * The new session will not be findable through its stream ID.
 *
 * @param connectionManagerDomain the connection manager that is handling the connection
 *        of the session.
 * @param streamID the stream ID created by the connection manager for the new session.
 * @param hostName the address's hostname of the client or null if using old connection manager.
 * @param hostAddress the textual representation of the address of the client or null if using old CM.
 * @return true if a session was created or false if the client should disconnect.
 */
public boolean createClientSession(String connectionManagerDomain, StreamID streamID, String hostName, String hostAddress) {
    Connection connection = new ClientSessionConnection(connectionManagerDomain, hostName, hostAddress);
    // Check if client is allowed to connect from the specified IP address. Ignore the checking if connection
    // manager is old version and is not passing client's address
    byte[] address = null;
    try {
        address = connection.getAddress();
    } catch (UnknownHostException e) {
        // Ignore
    }
    if (address == null || LocalClientSession.isAllowed(connection)) {
        LocalClientSession session =
                SessionManager.getInstance().createClientSession(connection, streamID);
        // Register that this streamID belongs to the specified connection manager
        streamIDs.put(streamID, connectionManagerDomain);
        // Register which sessions are being hosted by the speicifed connection manager
        Map<StreamID, LocalClientSession> sessions = sessionsByManager.get(connectionManagerDomain);
        if (sessions == null) {
            synchronized (connectionManagerDomain.intern()) {
                sessions = sessionsByManager.get(connectionManagerDomain);
                if (sessions == null) {
                    sessions = new ConcurrentHashMap<>();
                    sessionsByManager.put(connectionManagerDomain, sessions);
                }
            }
        }
        sessions.put(streamID, session);
        return true;
    }
    return false;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:43,代码来源:ConnectionMultiplexerManager.java

示例2: createClientSession

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Creates a new client session that was established to the specified connection manager.
 * The new session will not be findable through its stream ID.
 *
 * @param connectionManagerDomain the connection manager that is handling the connection
 *        of the session.
 * @param streamID the stream ID created by the connection manager for the new session.
 * @param hostName the address's hostname of the client or null if using old connection manager.
 * @param hostAddress the textual representation of the address of the client or null if using old CM.
 * @return true if a session was created or false if the client should disconnect.
 */
public boolean createClientSession(String connectionManagerDomain, String streamID, String hostName, String hostAddress) {
    Connection connection = new ClientSessionConnection(connectionManagerDomain, hostName, hostAddress);
    // Check if client is allowed to connect from the specified IP address. Ignore the checking if connection
    // manager is old version and is not passing client's address
    byte[] address = null;
    try {
        address = connection.getAddress();
    } catch (UnknownHostException e) {
        // Ignore
    }
    if (address == null || LocalClientSession.isAllowed(connection)) {
        LocalClientSession session =
                SessionManager.getInstance().createClientSession(connection, new BasicStreamID(streamID));
        // Register that this streamID belongs to the specified connection manager
        streamIDs.put(streamID, connectionManagerDomain);
        // Register which sessions are being hosted by the speicifed connection manager
        Map<String, LocalClientSession> sessions = sessionsByManager.get(connectionManagerDomain);
        if (sessions == null) {
            synchronized (connectionManagerDomain.intern()) {
                sessions = sessionsByManager.get(connectionManagerDomain);
                if (sessions == null) {
                    sessions = new ConcurrentHashMap<String, LocalClientSession>();
                    sessionsByManager.put(connectionManagerDomain, sessions);
                }
            }
        }
        sessions.put(streamID, session);
        return true;
    }
    return false;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:43,代码来源:ConnectionMultiplexerManager.java


注:本文中的org.jivesoftware.openfire.session.LocalClientSession.isAllowed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。