<%-- - $Revision$ - $Date$ - - Copyright (C) 2004 Jive Software. All rights reserved. - - This software is published under the terms of the GNU Public License (GPL), - a copy of which is included in this distribution. --%> <%@ page import="org.jivesoftware.openfire.SessionManager, org.jivesoftware.openfire.session.IncomingServerSession, org.jivesoftware.openfire.session.OutgoingServerSession, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.ParamUtils, java.text.NumberFormat" errorPage="error.jsp" %> <%@ page import="java.util.Calendar" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.List" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <% webManager.init(request, response, session, application, out ); %> <% // Get parameters String hostname = ParamUtils.getParameter(request, "hostname"); // Handle a "go back" click: if (request.getParameter("back") != null) { response.sendRedirect("server-session-summary.jsp"); return; } // Get the session & address objects SessionManager sessionManager = webManager.getSessionManager(); List inSessions = sessionManager.getIncomingServerSessions(hostname); OutgoingServerSession outSession = sessionManager.getOutgoingServerSession(hostname); // Number dateFormatter for all numbers on this page: NumberFormat numFormatter = NumberFormat.getNumberInstance(); %> <fmt:message key="server.session.details.title"/>

"+hostname+"" %>" />

<% if (!inSessions.isEmpty() && outSession == null) { %> "> <% } else if (inSessions.isEmpty() && outSession != null) { %> "> <% } else { %> "> <% } %>
<% if (!inSessions.isEmpty()) { %> <%= inSessions.get(0).getHostAddress() %> / <%= inSessions.get(0).getHostName() %> <% } else if (outSession != null) { %> <%= outSession.getHostAddress() %> / <%= outSession.getHostName() %> <% } %>

<% // Show details of the incoming sessions for (IncomingServerSession inSession : inSessions) { %>
<% if (inSession.isSecure()) { %> <% } else { %> <% } %> <% Date creationDate = inSession.getCreationDate(); Date lastActiveDate = inSession.getLastActiveDate(); Calendar creationCal = Calendar.getInstance(); creationCal.setTime(creationDate); 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); %>
<%= inSession.getStreamID()%> <%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %> <%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %> <%= numFormatter.format(inSession.getNumClientPackets()) %>

<% } %> <% // Show details of the incoming session if (outSession != null) { %>
<% if (outSession.isSecure()) { %> <% } else { %> <% } %> <% Date creationDate = outSession.getCreationDate(); Date lastActiveDate = outSession.getLastActiveDate(); Calendar creationCal = Calendar.getInstance(); creationCal.setTime(creationDate); 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); %>
<%= outSession.getStreamID()%> <%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %> <%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %> <%= numFormatter.format(outSession.getNumServerPackets()) %>

<% } %>
">