org.apache.catalina.manager

## Class StatusTransformer

- java.lang.Object
- - org.apache.catalina.manager.StatusTransformer

-     public class StatusTransformer
      extends Object

  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

    Constructors
    Constructor and Description
    `StatusTransformer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `filter(Object obj)` Filter the specified message string for characters that are sensitive in HTML.
    `static 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 KB or MB.
    `static String` | `formatTime(Object obj, boolean seconds)` Display the given time in ms, either as ms or s.
    `static void` | `setContentType(HttpServletResponse response, int mode)`
    `static void` | `writeBody(PrintWriter writer, Object[] args, int mode)` Write the header body.
    `static void` | `writeConnectorState(PrintWriter writer, ObjectName tpName, String name, MBeanServer mBeanServer, Vector<ObjectName> globalRequestProcessors, Vector<ObjectName> requestProcessors, int mode)` 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` | `writeOSState(PrintWriter writer, int mode)` Write the OS state.
    `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)` Write the VM state.
    `static void` | `writeWrapper(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode)` Write detailed information about a wrapper.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StatusTransformer

          public StatusTransformer()

  - ### Method Detail

    - #### setContentType

          public static void setContentType(HttpServletResponse response,
                            int mode)

    - #### writeHeader

          public static void writeHeader(PrintWriter writer,
                         Object[] args,
                         int mode)

      Write an HTML or XML header.
      Parameters:
        `writer` - the PrintWriter to use
        `args` - Path prefix for URLs
        `mode` - - 0 = HTML header, 1 = XML declaration

    - #### writeBody

          public static void writeBody(PrintWriter writer,
                       Object[] args,
                       int mode)

      Write the header body. XML output doesn't bother to output this stuff, since it's just title.
      Parameters:
        `writer` - The output writer
        `args` - What to write
        `mode` - 0 means write

    - #### writeManager

          public static void writeManager(PrintWriter writer,
                          Object[] args,
                          int mode)

      Write the manager webapp information.
      Parameters:
        `writer` - The output writer
        `args` - What to write
        `mode` - 0 means write

    - #### writePageHeading

          public static void writePageHeading(PrintWriter writer,
                              Object[] args,
                              int mode)

    - #### writeServerInfo

          public static void writeServerInfo(PrintWriter writer,
                             Object[] args,
                             int mode)

    - #### writeFooter

          public static void writeFooter(PrintWriter writer,
                         int mode)

    - #### writeOSState

          public static void writeOSState(PrintWriter writer,
                          int mode)

      Write the OS state. Mode 0 will generate HTML. Mode 1 will generate XML.

    - #### writeVMState

          public static void writeVMState(PrintWriter writer,
                          int mode)
                                   throws Exception

      Write the VM state. Mode 0 will generate HTML. Mode 1 will generate XML.
      Throws:
        `Exception`

    - #### writeConnectorState

          public static void writeConnectorState(PrintWriter writer,
                                 ObjectName tpName,
                                 String name,
                                 MBeanServer mBeanServer,
                                 Vector<ObjectName> globalRequestProcessors,
                                 Vector<ObjectName> requestProcessors,
                                 int mode)
                                          throws Exception

      Write connector state.
      Throws:
        `Exception`

    - #### writeProcessorState

          protected static void writeProcessorState(PrintWriter writer,
                                 ObjectName pName,
                                 MBeanServer mBeanServer,
                                 int mode)
                                             throws Exception

      Write processor state.
      Throws:
        `Exception`

    - #### writeDetailedState

          public static void writeDetailedState(PrintWriter writer,
                                MBeanServer mBeanServer,
                                int mode)
                                         throws Exception

      Write applications state.
      Throws:
        `Exception`

    - #### writeContext

          protected static void writeContext(PrintWriter writer,
                          ObjectName objectName,
                          MBeanServer mBeanServer,
                          int mode)
                                      throws Exception

      Write context state.
      Throws:
        `Exception`

    - #### writeManager

          public static void writeManager(PrintWriter writer,
                          ObjectName objectName,
                          MBeanServer mBeanServer,
                          int mode)
                                   throws Exception

      Write detailed information about a manager.
      Throws:
        `Exception`

    - #### writeJspMonitor

          public static void writeJspMonitor(PrintWriter writer,
                             Set<ObjectName> jspMonitorONs,
                             MBeanServer mBeanServer,
                             int mode)
                                      throws Exception

      Write JSP monitoring information.
      Throws:
        `Exception`

    - #### writeWrapper

          public static void writeWrapper(PrintWriter writer,
                          ObjectName objectName,
                          MBeanServer mBeanServer,
                          int mode)
                                   throws Exception

      Write detailed information about a wrapper.
      Throws:
        `Exception`

    - #### filter

          public static String filter(Object obj)

      Filter the specified message string for characters that are sensitive in HTML. This avoids potential attacks caused by including JavaScript codes in the request URL that is often reported in error messages.
      Parameters:
        `obj` - The message string to be filtered

    - #### formatSize

          public static String formatSize(Object obj,
                          boolean mb)

      Display the given size in bytes, either as KB or MB.
      Parameters:
        `mb` - true to display megabytes, false for kilobytes

    - #### formatTime

          public static String formatTime(Object obj,
                          boolean seconds)

      Display the given time in ms, either as ms or s.
      Parameters:
        `seconds` - true to display seconds, false for milliseconds

    - #### formatSeconds

          public static String formatSeconds(Object obj)

      Formats the given time (given in seconds) as a string.
      Parameters:
        `obj` - Time object to be formatted as string
      Returns:
        String formatted time

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.