本文整理汇总了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();
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}