org.apache.catalina.manager.util.SessionUtils Java Examples

The following examples show how to use org.apache.catalina.manager.util.SessionUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JspHelper.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static String getDisplayUsedTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getUsedTimeForSession(in_session)/1000);
}
 
Example #2
Source File: JspHelper.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static String getDisplayInactiveTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getInactiveTimeForSession(in_session)/1000);
}
 
Example #3
Source File: JspHelper.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static String getDisplayTTLForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getTTLForSession(in_session)/1000);
}
 
Example #4
Source File: JspHelper.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static String getDisplayUsedTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getUsedTimeForSession(in_session)/1000);
}
 
Example #5
Source File: JspHelper.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static String getDisplayInactiveTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getInactiveTimeForSession(in_session)/1000);
}
 
Example #6
Source File: JspHelper.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static String getDisplayTTLForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getTTLForSession(in_session)/1000);
}
 
Example #7
Source File: JspHelper.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public static String getDisplayInactiveTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getInactiveTimeForSession(in_session)/1000);
}
 
Example #8
Source File: JspHelper.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public static String getDisplayTTLForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getTTLForSession(in_session)/1000);
}
 
Example #9
Source File: JspHelper.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public static String getDisplayUsedTimeForSession(Session in_session) {
    try {
        if (in_session.getCreationTime() == 0) {
            return "";
        }
    } catch (IllegalStateException ise) {
        //ignore: invalidated session
        return "";
    }
    return secondsToTimeString(SessionUtils.getUsedTimeForSession(in_session)/1000);
}
 
Example #10
Source File: HTMLManagerServlet.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
protected Comparator<Session> getComparator(String sortBy) {
    Comparator<Session> comparator = null;
    if ("CreationTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getCreationTime());
            }
        };
    } else if ("id".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return session.getId();
            }
        };
    } else if ("LastAccessedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getLastAccessedTime());
            }
        };
    } else if ("MaxInactiveInterval".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getMaxInactiveInterval());
            }
        };
    } else if ("new".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Boolean>() {
            @Override
            public Comparable<Boolean> getComparableObject(Session session) {
                return Boolean.valueOf(session.getSession().isNew());
            }
        };
    } else if ("locale".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayLocaleFromSession(session);
            }
        };
    } else if ("user".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayUserFromSession(session);
            }
        };
    } else if ("UsedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getUsedTimeForSession(session));
            }
        };
    } else if ("InactiveTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getInactiveTimeForSession(session));
            }
        };
    } else if ("TTL".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getTTLForSession(session));
            }
        };
    }
    //TODO: complete this to TTL, etc.
    return comparator;
}
 
Example #11
Source File: HTMLManagerServlet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
protected Comparator<Session> getComparator(String sortBy) {
    Comparator<Session> comparator = null;
    if ("CreationTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getCreationTime());
            }
        };
    } else if ("id".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return session.getId();
            }
        };
    } else if ("LastAccessedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getLastAccessedTime());
            }
        };
    } else if ("MaxInactiveInterval".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Integer>() {
            @Override
            public Comparable<Integer> getComparableObject(Session session) {
                return Integer.valueOf(session.getMaxInactiveInterval());
            }
        };
    } else if ("new".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Boolean>() {
            @Override
            public Comparable<Boolean> getComparableObject(Session session) {
                return Boolean.valueOf(session.getSession().isNew());
            }
        };
    } else if ("locale".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayLocaleFromSession(session);
            }
        };
    } else if ("user".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayUserFromSession(session);
            }
        };
    } else if ("UsedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getUsedTimeForSession(session));
            }
        };
    } else if ("InactiveTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getInactiveTimeForSession(session));
            }
        };
    } else if ("TTL".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getTTLForSession(session));
            }
        };
    }
    //TODO: complete this to TTL, etc.
    return comparator;
}
 
Example #12
Source File: HTMLManagerServlet.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
protected Comparator<Session> getComparator(String sortBy) {
    Comparator<Session> comparator = null;
    if ("CreationTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getCreationTime());
            }
        };
    } else if ("id".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return session.getId();
            }
        };
    } else if ("LastAccessedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getLastAccessedTime());
            }
        };
    } else if ("MaxInactiveInterval".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(session.getMaxInactiveInterval());
            }
        };
    } else if ("new".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Boolean>() {
            @Override
            public Comparable<Boolean> getComparableObject(Session session) {
                return Boolean.valueOf(session.getSession().isNew());
            }
        };
    } else if ("locale".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayLocaleFromSession(session);
            }
        };
    } else if ("user".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<String>() {
            @Override
            public Comparable<String> getComparableObject(Session session) {
                return JspHelper.guessDisplayUserFromSession(session);
            }
        };
    } else if ("UsedTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getUsedTimeForSession(session));
            }
        };
    } else if ("InactiveTime".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getInactiveTimeForSession(session));
            }
        };
    } else if ("TTL".equalsIgnoreCase(sortBy)) {
        comparator = new BaseSessionComparator<Date>() {
            @Override
            public Comparable<Date> getComparableObject(Session session) {
                return new Date(SessionUtils.getTTLForSession(session));
            }
        };
    }
    //TODO: complete this to TTL, etc.
    return comparator;
}
 
Example #13
Source File: JspHelper.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Try to get user locale from the session, if possible.
 * IMPLEMENTATION NOTE: this method has explicit support for Tapestry 3 and Struts 1.x
 * @param in_session
 * @return String
 */
public static String guessDisplayLocaleFromSession(Session in_session) {
    return localeToString(SessionUtils.guessLocaleFromSession(in_session));
}
 
Example #14
Source File: JspHelper.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Try to get user name from the session, if possible.
 * @param in_session
 * @return String
 */
public static String guessDisplayUserFromSession(Session in_session) {
    Object user = SessionUtils.guessUserFromSession(in_session);
    return escapeXml(user);
}
 
Example #15
Source File: JspHelper.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Try to get user locale from the session, if possible.
 * IMPLEMENTATION NOTE: this method has explicit support for Tapestry 3 and Struts 1.x
 * @param in_session
 * @return String
 */
public static String guessDisplayLocaleFromSession(Session in_session) {
    return localeToString(SessionUtils.guessLocaleFromSession(in_session));
}
 
Example #16
Source File: JspHelper.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Try to get user name from the session, if possible.
 * @param in_session
 * @return String
 */
public static String guessDisplayUserFromSession(Session in_session) {
    Object user = SessionUtils.guessUserFromSession(in_session);
    return escapeXml(user);
}
 
Example #17
Source File: JspHelper.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Try to get user name from the session, if possible.
 * @param in_session The Servlet session
 * @return the user name
 */
public static String guessDisplayUserFromSession(Session in_session) {
    Object user = SessionUtils.guessUserFromSession(in_session);
    return escapeXml(user);
}
 
Example #18
Source File: JspHelper.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Try to get user locale from the session, if possible.
 * IMPLEMENTATION NOTE: this method has explicit support for Tapestry 3 and
 * Struts 1.x
 *
 * @param in_session Session from which the locale should be guessed
 *
 * @return String
 */
public static String guessDisplayLocaleFromSession(Session in_session) {
    return localeToString(SessionUtils.guessLocaleFromSession(in_session));
}