org.apache.catalina.manager
Class StatusTransformer

java.lang.Object
  extended by org.apache.catalina.manager.StatusTransformer

public class StatusTransformer
extends java.lang.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.

Version:
$Revision: 1237 $ $Date: 2009-11-03 02:55:48 +0100 (Tue, 03 Nov 2009) $
Author:
Peter Lin

Constructor Summary
StatusTransformer()
           
 
Method Summary
static java.lang.String filter(java.lang.Object obj)
          Filter the specified message string for characters that are sensitive in HTML.
static java.lang.String formatSeconds(java.lang.Object obj)
          Formats the given time (given in seconds) as a string.
static java.lang.String formatSize(java.lang.Object obj, boolean mb)
          Display the given size in bytes, either as KB or MB.
static java.lang.String formatTime(java.lang.Object obj, boolean seconds)
          Display the given time in ms, either as ms or s.
static void setContentType(javax.servlet.http.HttpServletResponse response, int mode)
           
static void writeAppList(java.io.PrintWriter writer, javax.management.MBeanServer mBeanServer, int mode)
          Write applications state.
static void writeBody(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
          Write the header body.
static void writeConnectorState(java.io.PrintWriter writer, javax.management.ObjectName tpName, java.lang.String name, javax.management.MBeanServer mBeanServer, java.util.Vector globalRequestProcessors, java.util.Vector requestProcessors, int mode)
          Write connector state.
protected static void writeContext(java.io.PrintWriter writer, javax.management.ObjectName objectName, javax.management.MBeanServer mBeanServer, int mode)
          Write context state.
static void writeDetailedState(java.io.PrintWriter writer, javax.management.MBeanServer mBeanServer, int mode)
          Write applications state.
static void writeFooter(java.io.PrintWriter writer, int mode)
           
static void writeHeader(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
          Process a GET request for the specified resource.
static void writeJspMonitor(java.io.PrintWriter writer, java.util.Set jspMonitorONs, javax.management.MBeanServer mBeanServer, int mode)
          Write JSP monitoring information.
static void writeManager(java.io.PrintWriter writer, javax.management.ObjectName objectName, javax.management.MBeanServer mBeanServer, int mode)
          Write detailed information about a manager.
static void writeManager1(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
          Write the manager webapp information.
static void writeManager2(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
          Write the manager webapp information.
static void writeOSState(java.io.PrintWriter writer, int mode)
          Write the OS state.
static void writePageHeading(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
           
protected static void writeProcessorState(java.io.PrintWriter writer, javax.management.ObjectName pName, javax.management.MBeanServer mBeanServer, int mode)
          Write processor state.
static void writeServerInfo(java.io.PrintWriter writer, java.lang.Object[] args, int mode)
           
static void writeVMState(java.io.PrintWriter writer, int mode)
          Write the VM state.
static void writeWrapper(java.io.PrintWriter writer, javax.management.ObjectName objectName, javax.management.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(javax.servlet.http.HttpServletResponse response,
                                  int mode)

writeHeader

public static void writeHeader(java.io.PrintWriter writer,
                               java.lang.Object[] args,
                               int mode)
Process a GET request for the specified resource.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

writeBody

public static void writeBody(java.io.PrintWriter writer,
                             java.lang.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

writeManager1

public static void writeManager1(java.io.PrintWriter writer,
                                 java.lang.Object[] args,
                                 int mode)
Write the manager webapp information.

Parameters:
writer - The output writer
args - What to write
mode - 0 means write

writeManager2

public static void writeManager2(java.io.PrintWriter writer,
                                 java.lang.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(java.io.PrintWriter writer,
                                    java.lang.Object[] args,
                                    int mode)

writeServerInfo

public static void writeServerInfo(java.io.PrintWriter writer,
                                   java.lang.Object[] args,
                                   int mode)

writeFooter

public static void writeFooter(java.io.PrintWriter writer,
                               int mode)

writeOSState

public static void writeOSState(java.io.PrintWriter writer,
                                int mode)
Write the OS state. Mode 0 will generate HTML. Mode 1 will generate XML.


writeVMState

public static void writeVMState(java.io.PrintWriter writer,
                                int mode)
                         throws java.lang.Exception
Write the VM state. Mode 0 will generate HTML. Mode 1 will generate XML.

Throws:
java.lang.Exception

writeConnectorState

public static void writeConnectorState(java.io.PrintWriter writer,
                                       javax.management.ObjectName tpName,
                                       java.lang.String name,
                                       javax.management.MBeanServer mBeanServer,
                                       java.util.Vector globalRequestProcessors,
                                       java.util.Vector requestProcessors,
                                       int mode)
                                throws java.lang.Exception
Write connector state.

Throws:
java.lang.Exception

writeProcessorState

protected static void writeProcessorState(java.io.PrintWriter writer,
                                          javax.management.ObjectName pName,
                                          javax.management.MBeanServer mBeanServer,
                                          int mode)
                                   throws java.lang.Exception
Write processor state.

Throws:
java.lang.Exception

writeDetailedState

public static void writeDetailedState(java.io.PrintWriter writer,
                                      javax.management.MBeanServer mBeanServer,
                                      int mode)
                               throws java.lang.Exception
Write applications state.

Throws:
java.lang.Exception

writeAppList

public static void writeAppList(java.io.PrintWriter writer,
                                javax.management.MBeanServer mBeanServer,
                                int mode)
                         throws java.lang.Exception
Write applications state.

Throws:
java.lang.Exception

writeContext

protected static void writeContext(java.io.PrintWriter writer,
                                   javax.management.ObjectName objectName,
                                   javax.management.MBeanServer mBeanServer,
                                   int mode)
                            throws java.lang.Exception
Write context state.

Throws:
java.lang.Exception

writeManager

public static void writeManager(java.io.PrintWriter writer,
                                javax.management.ObjectName objectName,
                                javax.management.MBeanServer mBeanServer,
                                int mode)
                         throws java.lang.Exception
Write detailed information about a manager.

Throws:
java.lang.Exception

writeJspMonitor

public static void writeJspMonitor(java.io.PrintWriter writer,
                                   java.util.Set jspMonitorONs,
                                   javax.management.MBeanServer mBeanServer,
                                   int mode)
                            throws java.lang.Exception
Write JSP monitoring information.

Throws:
java.lang.Exception

writeWrapper

public static void writeWrapper(java.io.PrintWriter writer,
                                javax.management.ObjectName objectName,
                                javax.management.MBeanServer mBeanServer,
                                int mode)
                         throws java.lang.Exception
Write detailed information about a wrapper.

Throws:
java.lang.Exception

filter

public static java.lang.String filter(java.lang.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 java.lang.String formatSize(java.lang.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 java.lang.String formatTime(java.lang.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 java.lang.String formatSeconds(java.lang.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-2009 Apache Software Foundation. All Rights Reserved.