<%@ 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.openfire.session.ComponentSession, org.jivesoftware.openfire.session.Session, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.StringUtils, org.jivesoftware.util.ParamUtils, java.net.URLEncoder" errorPage="error.jsp" %> <%@ page import="java.util.ArrayList"%> <%@ page import="java.util.Calendar"%> <%@ page import="java.util.Collection"%> <%@ page import="java.util.Date"%> <%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %> <%@ page import="org.jivesoftware.openfire.session.LocalSession" %> <%@ page import="java.nio.charset.StandardCharsets" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%! final int DEFAULT_RANGE = 15; final int[] RANGE_PRESETS = {15, 25, 50, 75, 100}; %> <% admin.init(request, response, session, application, out ); %> <% // Get parameters int start = ParamUtils.getIntParameter(request, "start", 0); int range = ParamUtils .getIntParameter(request, "range", admin.getRowsPerPage("component-session-summary", DEFAULT_RANGE)); boolean close = ParamUtils.getBooleanParameter(request, "close"); String jid = ParamUtils.getParameter(request, "jid"); if (request.getParameter("range") != null) { admin.setRowsPerPage("component-session-summary", range); } // Get the session manager SessionManager sessionManager = admin.getSessionManager(); Collection sessions = sessionManager.getComponentSessions(); // Get the session count int sessionCount = sessions.size(); // Close the external component connection if (close) { try { Session sess = sessionManager.getComponentSession(jid); if (sess != null) { sess.markNonResumable(); sess.close(); } // Log the event admin.logEvent("closed component session for "+jid, null); // wait one second Thread.sleep(1000L); } catch (Exception ignored) { // Session might have disappeared on its own } // redirect back to this page response.sendRedirect("component-session-summary.jsp?close=success"); return; } // paginator vars int numPages = (int) Math.ceil((double) sessionCount / (double) range); int curPage = (start / range) + 1; int maxIndex = Math.min(start + range, sessionCount); final boolean clusteringEnabled = ClusterManager.isClusteringStarted() || ClusterManager.isClusteringStarting(); %> <fmt:message key="component.session.summary.title"/> <% if ("success".equals(request.getParameter("close"))) { %>

<% } %>

: <%= sessions.size() %> <% if (numPages > 1) { %> - <%= (start+1) %>-<%= (start+range) %> <% } %> - :

<% if (numPages > 1) { %>

: [ <% for (int i=0; i " ><%= (i+1) %><%= sep %> <% } %> ]

<% } %>

" />

<% if (clusteringEnabled) { %> <% } %> <% // Check if no out/in connection to/from a remote server exists if (sessions.isEmpty()) { %> <% } %> <% int count = 0; sessions = new ArrayList<>(sessions).subList(start, maxIndex); for (ComponentSession componentSession : sessions) { count++; %> <% if (clusteringEnabled) { %> <% } %> <% Date creationDate = componentSession.getCreationDate(); Calendar creationCal = Calendar.getInstance(); creationCal.setTime(creationDate); Date lastActiveDate = componentSession.getLastActiveDate(); Calendar lastActiveCal = Calendar.getInstance(); lastActiveCal.setTime(lastActiveDate); Calendar nowCal = Calendar.getInstance(); boolean sameCreationDay = nowCal.get(Calendar.DAY_OF_YEAR) == creationCal.get(Calendar.DAY_OF_YEAR) && nowCal.get(Calendar.YEAR) == creationCal.get(Calendar.YEAR); boolean sameActiveDay = nowCal.get(Calendar.DAY_OF_YEAR) == lastActiveCal.get(Calendar.DAY_OF_YEAR) && nowCal.get(Calendar.YEAR) == lastActiveCal.get(Calendar.YEAR); %> <% } %>
   
<%= count %> "><%= componentSession.getAddress() %> <% if (componentSession.isEncrypted()) { if (componentSession.getPeerCertificates() != null && componentSession.getPeerCertificates().length > 0) { %> <fmt:message key='session.row.click_ssl' /> (mutual authentication) <% } else { %> " alt=": <%= componentSession.getTLSProtocolName() + " (" + componentSession.getCipherSuiteName() +")" %>"> <% } } else { %> <% } %> <%= StringUtils.escapeHTMLTags(componentSession.getExternalComponent().getName()) %> <%= StringUtils.escapeHTMLTags(componentSession.getExternalComponent().getCategory()) %> <% if ("gateway".equals(componentSession.getExternalComponent().getCategory())) { if ("aim".equals(componentSession.getExternalComponent().getType())) { %> <% } else if ("irc".equals(componentSession.getExternalComponent().getType())) { %> <% } } %>
AIMIRC<%= StringUtils.escapeHTMLTags(componentSession.getExternalComponent().getType()) %>
<% if (componentSession instanceof LocalSession) { %> <% } else { %> <% } %> <%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %> <%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %> " onclick="return confirm('');" >
<% if (numPages > 1) { %>

: [ <% for (int i=0; i " ><%= (i+1) %><%= sep %> <% } %> ]

<% } %>

: <%= JiveGlobals.formatDateTime(new Date()) %>