com.ora.jsp.tags
Class DebugTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.ora.jsp.tags.DebugTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class DebugTag
extends javax.servlet.jsp.tagext.TagSupport

This class is a custom action that can be used to extract debug information from a JSP PageContext. The debug info is sent to the browser, System.out, and the application log file, depending on the value of the "debug" request parameter sent with the request for the JSP page: "resp", "stdout" and "log". The values can be combined to get the information directed to multiple targets.

Version:
1.0
Author:
Hans Bergsten, Gefion software
See Also:
Serialized Form

Field Summary
private static java.lang.String BEAN_ATTR
           
private static java.lang.String LINE_FEED
           
private static java.lang.String LOG_TYPE
           
private static java.lang.String RESP_TYPE
           
private static java.lang.String STDOUT_TYPE
           
private  java.lang.String type
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
DebugTag()
           
 
Method Summary
 int doEndTag()
          Writes the requested type of debug info to the sources specified by the "debug" request parameter: "resp" for response, "stdout" for System.out, and "log" for the application log file.
private  java.util.List getDebugType()
          Returns a List with all debug types based on the debug request parameter.
private  java.util.Map getInfo(java.lang.String type, DebugBean bean)
          Returns the debug info corresponding to the type.
private  void log(java.lang.String propName, java.util.Map values, java.util.List debugTypes)
           
private  void log(java.lang.String propName, java.lang.String msg, java.util.List debugTypes)
          Writes the specified property value to the System.out or the log file, depending on the requested debug type.
 void setType(java.lang.String type)
          Set the type property.
private  java.lang.String toHTMLTable(java.lang.String propName, java.util.Map values)
          Returns an HTML table with all the values of the specified property.
private  java.lang.String toTabbedTable(java.util.Map values)
          Returns an simple ASCII table with all the values of the specified property, used for log output.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_FEED

private static final java.lang.String LINE_FEED

RESP_TYPE

private static final java.lang.String RESP_TYPE
See Also:
Constant Field Values

STDOUT_TYPE

private static final java.lang.String STDOUT_TYPE
See Also:
Constant Field Values

LOG_TYPE

private static final java.lang.String LOG_TYPE
See Also:
Constant Field Values

BEAN_ATTR

private static final java.lang.String BEAN_ATTR
See Also:
Constant Field Values

type

private java.lang.String type
Constructor Detail

DebugTag

public DebugTag()
Method Detail

setType

public void setType(java.lang.String type)
Set the type property. One of "requestInfo", "headers", "cookies", "params", "pageScope", "requestScope", "sessionScope" or "applicationScope".


doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Writes the requested type of debug info to the sources specified by the "debug" request parameter: "resp" for response, "stdout" for System.out, and "log" for the application log file.

Throws:
javax.servlet.jsp.JspException

getDebugType

private java.util.List getDebugType()
Returns a List with all debug types based on the debug request parameter.


getInfo

private java.util.Map getInfo(java.lang.String type,
                              DebugBean bean)
                       throws javax.servlet.jsp.JspTagException
Returns the debug info corresponding to the type.

Throws:
javax.servlet.jsp.JspTagException

log

private void log(java.lang.String propName,
                 java.lang.String msg,
                 java.util.List debugTypes)
Writes the specified property value to the System.out or the log file, depending on the requested debug type.


log

private void log(java.lang.String propName,
                 java.util.Map values,
                 java.util.List debugTypes)

toHTMLTable

private java.lang.String toHTMLTable(java.lang.String propName,
                                     java.util.Map values)
Returns an HTML table with all the values of the specified property.


toTabbedTable

private java.lang.String toTabbedTable(java.util.Map values)
Returns an simple ASCII table with all the values of the specified property, used for log output.