Enable the HTML Manager application to differentiate between primary & backup sessions.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 29 Jul 2010 18:17:15 +0000 (18:17 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 29 Jul 2010 18:17:15 +0000 (18:17 +0000)
Both can be invalidated
Attributes can be viewed in both
Attributes can only be removed from primary sessions

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@980532 13f79535-47bb-0310-9956-ffa450edef68

webapps/manager/WEB-INF/jsp/sessionDetail.jsp
webapps/manager/WEB-INF/jsp/sessionsList.jsp

index 5f68948..19edd10 100644 (file)
                         <input type="hidden" name="action" value="removeSessionAttribute" />
                         <input type="hidden" name="sessionId" value="<%= currentSessionId %>" />
                         <input type="hidden" name="attributeName" value="<%= attributeName %>" />
-                        <input type="submit" value="Remove" />
+                                           <%
+                                             if ("Primary".equals(request.getAttribute("sessionType"))) {
+                                           %>
+                          <input type="submit" value="Remove" />
+                        <%
+                                             } else {
+                                               out.print("Primary sessions only");
+                                             }
+                        %>
                     </div>
                 </form>
             </td>
index 2f2d78b..5c994a4 100644 (file)
@@ -20,6 +20,7 @@
 <%@page import="java.util.Iterator" %>
 <%@page import="org.apache.catalina.manager.JspHelper" %>
 <%@page import="org.apache.catalina.Session" %>
+<%@page import="org.apache.catalina.ha.session.DeltaSession" %>
 <!DOCTYPE html 
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -69,6 +70,7 @@
                        <thead>
                                <tr>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='id'; document.getElementById('refreshButton').click(); return true;">Session Id</a></th>
+                    <th><a onclick="document.getElementById('sessionsFormSort').value='id'; document.getElementById('refreshButton').click(); return true;">Type</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='locale'; document.getElementById('refreshButton').click(); return true;">Guessed Locale</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='user'; document.getElementById('refreshButton').click(); return true;">Guessed User name</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='CreationTime'; document.getElementById('refreshButton').click(); return true;">Creation Time</a></th>
@@ -82,6 +84,7 @@
                        <tfoot><%-- <tfoot> is the same as <thead> --%>
                                <tr>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='id'; document.getElementById('refreshButton').click(); return true;">Session Id</a></th>
+                    <th><a onclick="document.getElementById('sessionsFormSort').value='id'; document.getElementById('refreshButton').click(); return true;">Type</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='locale'; document.getElementById('refreshButton').click(); return true;">Guessed Locale</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='user'; document.getElementById('refreshButton').click(); return true;">Guessed User name</a></th>
                                        <th><a onclick="document.getElementById('sessionsFormSort').value='CreationTime'; document.getElementById('refreshButton').click(); return true;">Creation Time</a></th>
    while (iter.hasNext()) {
        Session currentSession = (Session) iter.next();
        String currentSessionId = currentSession.getId();
+       String type;
+       if (currentSession instanceof DeltaSession) {
+           if (((DeltaSession) currentSession).isPrimarySession()) {
+               type = "Primary";
+           } else {
+               type = "Backup";
+           }
+       } else {
+           type = "Primary";
+       }
 %>
                                <tr>
-                                       <td>
-<input type="checkbox" name="sessionIds" value="<%= currentSessionId %>" /><a href="<%= submitUrl %>&amp;action=sessionDetail&amp;sessionId=<%= currentSessionId %>"><%= JspHelper.escapeXml(currentSessionId) %></a>
+                                       <td><input type="checkbox" name="sessionIds" value="<%= currentSessionId %>" />
+                                         <a href="<%= submitUrl %>&amp;action=sessionDetail&amp;sessionId=<%= currentSessionId %>&amp;sessionType=<%= type %>"><%= JspHelper.escapeXml(currentSessionId) %></a>
                                        </td>
+                    <td style="text-align: center;"><%= type %></td>
                                        <td style="text-align: center;"><%= JspHelper.guessDisplayLocaleFromSession(currentSession) %></td>
                                        <td style="text-align: center;"><%= JspHelper.guessDisplayUserFromSession(currentSession) %></td>
                                        <td style="text-align: center;"><%= JspHelper.getDisplayCreationTimeForSession(currentSession) %></td>