<%@ page contentType="text/html; charset=UTF-8" %> <%-- - - Copyright (C) 2026 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.server.OutgoingSessionPromise, org.jivesoftware.openfire.server.FailedOutgoingServerSessionAttempt, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.ParamUtils, org.jivesoftware.util.StringUtils, org.jivesoftware.util.CookieUtils, java.net.URLEncoder, java.nio.charset.StandardCharsets, java.util.*" errorPage="error.jsp" %> <%@ 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" %> <%@ taglib uri="admin" prefix="admin" %> <% webManager.init(request, response, session, application, out ); %> <% final String domainName = ParamUtils.getParameter(request, "hostname"); final SessionManager sessionManager = webManager.getSessionManager(); final Set failedServers = new HashSet<>(sessionManager.getFailedServers()); final Map errors = new HashMap<>(); if (domainName == null || domainName.trim().isEmpty()) { response.sendRedirect("server-session-summary.jsp"); return; } if (!failedServers.contains(domainName)) { response.sendRedirect("server-session-details.jsp?hostname=" + java.net.URLEncoder.encode(domainName, java.nio.charset.StandardCharsets.UTF_8)); return; } final Optional failedAttempt = OutgoingSessionPromise.getInstance().getFailedServerAttempt(domainName); final List diagnosticLogLines = failedAttempt.map(FailedOutgoingServerSessionAttempt::getDiagnosticLog).orElse(Collections.emptyList()); final String diagnosticLog = String.join("\n", diagnosticLogLines); Cookie csrfCookie = CookieUtils.getCookie(request, "csrf"); String csrfParam = ParamUtils.getParameter(request, "csrf"); String action = ParamUtils.getParameter(request, "action"); boolean showSearchResults = false; final Set matchingLocalUsers = new TreeSet<>(); if (action != null) { if (csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam)) { errors.put("csrf", "CSRF Failure!"); } if (errors.isEmpty()) { switch (action) { case "retry": response.sendRedirect("server-connectiontest.jsp?server2server-testing-domain=" + URLEncoder.encode(domainName, StandardCharsets.UTF_8)); return; case "block": response.sendRedirect("connection-settings-socket-s2s.jsp?serverBlocked=true&domain=" + URLEncoder.encode(domainName, StandardCharsets.UTF_8)); return; case "search": showSearchResults = true; break; default: errors.put("Unknown action", "unknown action"); break; } } } if (showSearchResults) { matchingLocalUsers.addAll(webManager.getRosterManager().getUsernamesWithRosterItemsOnDomain(domainName)); } csrfParam = StringUtils.randomString(15); CookieUtils.setCookie(request, response, "csrf", csrfParam, -1); pageContext.setAttribute("errors", errors); %> <fmt:message key="server.session.failure.title"/>

<%= StringUtils.escapeForXML(domainName) %>

: ()
<%= StringUtils.escapeHTMLTags(domainName) %>
<fmt:message key='server.session.connection.failed' />
<% if (failedAttempt.isPresent() && failedAttempt.get().getWhen() != null) { %> <%= JiveGlobals.formatDateTime(Date.from(failedAttempt.get().getWhen())) %> <% } else { %> <% } %>
<% if (failedAttempt.isPresent() && failedAttempt.get().getErrorMessage() != null && !failedAttempt.get().getErrorMessage().trim().isEmpty()) { %> <%= StringUtils.escapeHTMLTags(failedAttempt.get().getErrorMessage()) %> <% } else if (failedAttempt.isPresent() && failedAttempt.get().getErrorType() != null) { %> <%= StringUtils.escapeHTMLTags(failedAttempt.get().getErrorType()) %> <% } else { %> <% } %>

<% if (!diagnosticLogLines.isEmpty()) { %> <% } else { %> <% } %>

" onclick="document.getElementById('failure-action').value='retry';"/> " onclick="document.getElementById('failure-action').value='block';"/> " onclick="document.getElementById('failure-action').value='search';"/> " formaction="server-session-summary.jsp" onclick="document.getElementById('failure-action').value='';"/>
<% if (showSearchResults) { %>
<% if (matchingLocalUsers.isEmpty()) { %> <% } else { %> <% for (final String username : matchingLocalUsers) { %> <% } %> <% } %>
<%= StringUtils.escapeHTMLTags(username) %>
<% } %>