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


Java ClientSession.close方法代码示例

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


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

示例1: logout

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
/**
 * Disconnect an XMPP session of a user identified by an oauth token.
 * @param headers
 * @return
 */
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("logout")
public Response logout(@Context HttpHeaders headers) {
  TokenInfo tokenInfo = RestUtils.getAuthTokenInfo(headers);
  if (tokenInfo == null) {
    return RestUtils.getUnauthJAXRSResp();
  }
  
  JID from = RestUtils.createJID(tokenInfo);
  XMPPServer xmppSrv = XMPPServer.getInstance();
  SessionManager sessionMgr = xmppSrv.getSessionManager();
  ClientSession session = sessionMgr.getSession(from);
  if (session == null) {
    ErrorResponse response = new ErrorResponse(ErrorCode.USER_NOT_LOGIN,
        String.format("Session is not found: %s [%s]", from, tokenInfo.getUserName()));
    return RestUtils.getJAXRSResp(Response.Status.GONE, response);
  }
  // Terminate the session now.
  session.close();
  return RestUtils.getOKJAXRSResp();
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:28,代码来源:UserResource.java

示例2: destroy

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
@Override
public void destroy()
{
    // terminate any active websocket sessions
    SessionManager sm = XMPPServer.getInstance().getSessionManager();
    for (ClientSession session : sm.getSessions()) {
        if (session instanceof LocalSession) {
            Object ws = ((LocalSession) session).getSessionData("ws");
            if (ws != null && (Boolean) ws) {
                session.close();
            }
        }
    }

    super.destroy();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:OpenfireWebSocketServlet.java

示例3: terminateSessions

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
/**
 * Terminate open session for the user with specified user name. Username should be complete ie it should
 * include the % appid.
 * @param username
 */
public static void terminateSessions(String username) throws ServerNotInitializedException {
  final StreamError error = new StreamError(StreamError.Condition.not_authorized);
  for (ClientSession session : getSessionManager().getSessions(username) ) {
    LOGGER.info("Terminating session for user with name:{}", username);
    session.deliverRawText(error.toXML());
    session.close();
  }
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:14,代码来源:UserManagerService.java

示例4: deleteUser

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
private static void deleteUser(User oldUser) {
    UserManager.getInstance().deleteUser(oldUser);
    final StreamError error = new StreamError(StreamError.Condition.not_authorized);
    for (ClientSession sess : SessionManager.getInstance().getSessions(oldUser.getUsername())) {
        sess.deliverRawText(error.toXML());
        sess.close();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:JustMarriedPlugin.java

示例5: disableUser

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
/**
 * Disable user.
 *
 * @param username
 *            the username
 * @throws ServiceException
 *             the service exception
 */
public void disableUser(String username) throws ServiceException {
    getAndCheckUser(username);
    lockOutManager.disableAccount(username, null, null);
    
    if (lockOutManager.isAccountDisabled(username)) {
        final StreamError error = new StreamError(StreamError.Condition.not_authorized);
        for (ClientSession sess : SessionManager.getInstance().getSessions(username)) {
            sess.deliverRawText(error.toXML());
            sess.close();
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:UserServiceController.java

示例6: removeUserSessions

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
/**
 * Removes the user sessions.
 *
 * @param username the username
 * @throws ServiceException the service exception
 */
public void removeUserSessions(String username) throws ServiceException {
    final StreamError error = new StreamError(StreamError.Condition.not_authorized);
    for (ClientSession session : SessionManager.getInstance().getSessions(username)) {
        session.deliverRawText(error.toXML());
        session.close();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:14,代码来源:SessionController.java

示例7: deleteUser

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
/**
 * Delete user.
 *
 * @param oldUser
 *            the old user
 */
private static void deleteUser(User oldUser) {
    UserManager.getInstance().deleteUser(oldUser);
    LockOutManager.getInstance().enableAccount(oldUser.getUsername());
    final StreamError error = new StreamError(StreamError.Condition.not_authorized);
    for (ClientSession sess : SessionManager.getInstance().getSessions(oldUser.getUsername())) {
        sess.deliverRawText(error.toXML());
        sess.close();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:16,代码来源:JustMarriedController.java

示例8: deleteUser

import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
private static void deleteUser(User oldUser) {
	UserManager.getInstance().deleteUser(oldUser);
	final StreamError error = new StreamError(StreamError.Condition.not_authorized);
	for (ClientSession sess : SessionManager.getInstance().getSessions(oldUser.getUsername())) {
		sess.deliverRawText(error.toXML());
		sess.close();
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:9,代码来源:JustMarriedPlugin.java


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