Package org.apache.catalina.manager
Class StatusTransformer
java.lang.Object
org.apache.catalina.manager.StatusTransformer
This is a refactoring of the servlet to externalize the output into a simple class. Although we could use XSLT, that
is unnecessarily complex.
- Author:
- Peter Lin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatSeconds
(Object obj) Formats the given time (given in seconds) as a string.static String
formatSize
(Object obj, boolean mb) Display the given size in bytes, either as KiB or MiB.static String
formatTime
(Object obj, boolean seconds) Display the given time in ms, either as ms or s.protected static String
getConnectorName
(String name) Return the connector name without the port, for auto port connectors.static void
setContentType
(HttpServletResponse response, int mode) static void
writeBody
(PrintWriter writer, Object[] args, int mode) Write the header body.static void
writeConnectorsState
(PrintWriter writer, MBeanServer mBeanServer, List<ObjectName> threadPools, List<ObjectName> globalRequestProcessors, List<ObjectName> requestProcessors, int mode, Object[] args) Write connector state.static void
writeConnectorState
(PrintWriter writer, ObjectName tpName, String name, MBeanServer mBeanServer, List<ObjectName> globalRequestProcessors, List<ObjectName> requestProcessors, int mode, Object[] args) Write connector state.protected static void
writeContext
(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) Write context state.static void
writeDetailedState
(PrintWriter writer, MBeanServer mBeanServer, int mode) Write applications state.static void
writeFooter
(PrintWriter writer, int mode) static void
writeHeader
(PrintWriter writer, Object[] args, int mode) Write an HTML or XML header.static void
writeJspMonitor
(PrintWriter writer, Set<ObjectName> jspMonitorONs, MBeanServer mBeanServer, int mode) Write JSP monitoring information.static void
writeManager
(PrintWriter writer, Object[] args, int mode) Write the manager webapp information.static void
writeManager
(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) Write detailed information about a manager.static void
writePageHeading
(PrintWriter writer, Object[] args, int mode) protected static void
writeProcessorState
(PrintWriter writer, ObjectName pName, MBeanServer mBeanServer, int mode) Write processor state.static void
writeServerInfo
(PrintWriter writer, Object[] args, int mode) static void
writeVMState
(PrintWriter writer, int mode, Object[] args) Write the VM state.static void
writeWrapper
(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) Write detailed information about a wrapper.
-
Constructor Details
-
StatusTransformer
public StatusTransformer()
-
-
Method Details
-
setContentType
-
writeHeader
Write an HTML or XML header.- Parameters:
writer
- the PrintWriter to useargs
- Path prefix for URLsmode
- - 0 = HTML header, 1 = XML declaration, 2 = JSON
-
writeBody
Write the header body. XML output doesn't bother to output this stuff, since it's just title.- Parameters:
writer
- The output writerargs
- What to writemode
- 0 means write
-
writeManager
Write the manager webapp information.- Parameters:
writer
- The output writerargs
- What to writemode
- 0 means write
-
writePageHeading
-
writeServerInfo
-
writeVMState
Write the VM state.- Parameters:
writer
- The output writermode
- Mode0
will generate HTML. Mode1
will generate XML.args
- I18n labels for the VM state values- Throws:
Exception
- Propagated JMX error
-
writeConnectorsState
public static void writeConnectorsState(PrintWriter writer, MBeanServer mBeanServer, List<ObjectName> threadPools, List<ObjectName> globalRequestProcessors, List<ObjectName> requestProcessors, int mode, Object[] args) throws Exception Write connector state.- Parameters:
writer
- The output writermBeanServer
- MBean serverthreadPools
- MBean names for the thread pools of the connectorsglobalRequestProcessors
- MBean names for the global request processorsrequestProcessors
- MBean names for the request processorsmode
- Mode0
will generate HTML. Mode1
will generate XML.args
- I18n labels for the Connector state values- Throws:
Exception
- Propagated JMX error
-
writeConnectorState
public static void writeConnectorState(PrintWriter writer, ObjectName tpName, String name, MBeanServer mBeanServer, List<ObjectName> globalRequestProcessors, List<ObjectName> requestProcessors, int mode, Object[] args) throws Exception Write connector state.- Parameters:
writer
- The output writertpName
- MBean name of the thread poolname
- Connector namemBeanServer
- MBean serverglobalRequestProcessors
- MBean names for the global request processorsrequestProcessors
- MBean names for the request processorsmode
- Mode0
will generate HTML. Mode1
will generate XML.args
- I18n labels for the Connector state values- Throws:
Exception
- Propagated JMX error
-
getConnectorName
-
writeProcessorState
protected static void writeProcessorState(PrintWriter writer, ObjectName pName, MBeanServer mBeanServer, int mode) throws Exception Write processor state.- Parameters:
writer
- The output writerpName
- MBean name of the processormBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
writeDetailedState
public static void writeDetailedState(PrintWriter writer, MBeanServer mBeanServer, int mode) throws Exception Write applications state.- Parameters:
writer
- The output writermBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
writeContext
protected static void writeContext(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) throws Exception Write context state.- Parameters:
writer
- The output writerobjectName
- The context MBean namemBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
writeManager
public static void writeManager(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) throws Exception Write detailed information about a manager.- Parameters:
writer
- The output writerobjectName
- The manager MBean namemBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
writeJspMonitor
public static void writeJspMonitor(PrintWriter writer, Set<ObjectName> jspMonitorONs, MBeanServer mBeanServer, int mode) throws Exception Write JSP monitoring information.- Parameters:
writer
- The output writerjspMonitorONs
- The JSP MBean namesmBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
writeWrapper
public static void writeWrapper(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) throws Exception Write detailed information about a wrapper.- Parameters:
writer
- The output writerobjectName
- The wrapper MBean namesmBeanServer
- MBean servermode
- Mode0
will generate HTML. Mode1
will generate XML.- Throws:
Exception
- Propagated JMX error
-
formatSize
-
formatTime
-
formatSeconds
-