<%@ page contentType="text/html; charset=UTF-8" %> <%-- - - Copyright (C) 2004-2008 Jive Software, 2017-2025 Ignite Realtime Foundation. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> <%@ page import="org.jivesoftware.openfire.SessionManager, org.jivesoftware.util.ParamUtils" errorPage="error.jsp" %> <%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %> <%@ page import="java.util.stream.Collectors" %> <%@ page import="java.util.*" %> <%@ page import="java.net.InetAddress" %> <%@ page import="org.jivesoftware.util.CookieUtils" %> <%@ page import="org.jivesoftware.util.StringUtils" %> <%@ page import="org.jivesoftware.openfire.session.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <% webManager.init(request, response, session, application, out ); %> <% // Get parameters String domainname = ParamUtils.getParameter(request, "hostname"); boolean close = request.getParameter("close") != null; Cookie csrfCookie = CookieUtils.getCookie(request, "csrf"); String csrfParam = ParamUtils.getParameter(request, "csrf"); if (close) { if (csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam)) { close = false; } } csrfParam = StringUtils.randomString(15); CookieUtils.setCookie(request, response, "csrf", csrfParam, -1); pageContext.setAttribute("csrf", csrfParam); // Get the session manager SessionManager sessionManager = webManager.getSessionManager(); // Close all connections related to the specified domain name if (close) { try { final List incomingServerSessions = sessionManager.getIncomingServerSessions(domainname); for (Session incomingServerSession : incomingServerSessions) { incomingServerSession.markNonResumable(); incomingServerSession.close(); } Collection outgoingServerSessions = sessionManager.getOutgoingServerSessions(domainname); for (OutgoingServerSession outgoingServerSession : outgoingServerSessions) { if (outgoingServerSession != null) { outgoingServerSession.markNonResumable(); outgoingServerSession.close(); } } // Log the event webManager.logEvent("closed server sessions for "+ domainname, "Closed " + incomingServerSessions.size() + " incoming and " + outgoingServerSessions + " outgoing session(s)."); // wait one second Thread.sleep(250L); } catch (Exception ignored) { // Session might have disappeared on its own } // redirect back to this page response.sendRedirect("server-session-summary.jsp?close=success"); return; } // Handle a "go back" click: if (request.getParameter("back") != null) { response.sendRedirect("server-session-summary.jsp"); return; } // Get the session & address objects List inSessions = sessionManager.getIncomingServerSessions(domainname); List outSessions = sessionManager.getOutgoingServerSessions(domainname); // Sort them by remote peer. final Map> inByHost = inSessions.stream().collect(Collectors.groupingBy(e -> { try { return e.getHostAddress(); } catch (Exception t) { return "Invalid session/connection"; } }, Collectors.mapping(e -> e, Collectors.toSet()))); final Map> outByHost = outSessions.stream().collect(Collectors.groupingBy(e -> { try { return e.getHostAddress(); } catch (Exception t) { return "Invalid session/connection"; } }, Collectors.mapping(e -> e, Collectors.toSet()))); Map allHosts = new HashMap<>(); Set hosts = new HashSet<>(); hosts.addAll(inByHost.keySet()); hosts.addAll(outByHost.keySet()); for (String host : hosts) { try { allHosts.put(host, InetAddress.getByName(host).getCanonicalHostName()); } catch (Exception e) { allHosts.put(host, null); } } final boolean clusteringEnabled = ClusterManager.isClusteringStarted() || ClusterManager.isClusteringStarting(); pageContext.setAttribute("domainname", domainname); pageContext.setAttribute("allHosts", allHosts); pageContext.setAttribute("inByHost", inByHost); pageContext.setAttribute("outByHost", outByHost); pageContext.setAttribute("clusteringEnabled", clusteringEnabled); %> <fmt:message key="server.session.details.title"/>

<fmt:message key='server.session.connection.incoming' /> <fmt:message key='server.session.connection.outgoing' /> <fmt:message key='server.session.connection.both' />

/
<fmt:message key='server.session.connection.incoming' /> <fmt:message key='server.session.connection.outgoing' /> <fmt:message key='server.session.connection.both' />
An encrypted connection An unencrypted connection
An encrypted connection An unencrypted connection

">