com.ibm.wbi.http.beans
Class AddPreambleEditor

com.ibm.wbi.plugin.Meg
  |
  +--com.ibm.wbi.plugin.Editor
        |
        +--com.ibm.wbi.http.plugin.HttpEditor
              |
              +--com.ibm.wbi.http.beans.AddPreambleEditor

public class AddPreambleEditor
extends HttpEditor

An Editor that adds content to the beginning of an HTML document. The content can either be plain HTML markup or Script. There are two properties which can be set: the PreambleHTMLString and the PreambleType. The first is the actual HTML that will be added to the document. The second specifies whether the HTML is to be added to the body of the document or is a script that should be added to the head of the document.


Field Summary
static int BODY
          specifies that the PreambleHTMLString should be added to the body of the document (the default).
static int JSCRIPT
          specifies that the PreambleHTMLString should be added to the head of the document (useful for scripts).
 
Fields inherited from class com.ibm.wbi.http.plugin.HttpEditor
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.plugin.Editor
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.plugin.Meg
COPYRIGHT, EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
AddPreambleEditor()
          construct an instance with a null PreambleHTMLString and a PreambleType of BODY.
AddPreambleEditor(java.lang.String h)
          construct an instance with the given PreambleHTMLString and a PreambleType of BODY.
AddPreambleEditor(java.lang.String h, int type)
          construct an instance with the given PreambleHTMLString and PreambleType.
 
Method Summary
 java.lang.String getPreambleHTMLString()
          access the PreambleHTMLString property.
 int getPreambleType()
          access the PreambleType property.
 void handleRequest(RequestEvent e)
          the method used by WBI to edit the document and add the HTML.
 void setPreambleHtmlString(java.lang.String h)
          set the PreambleHTMLString property.
 void setPreambleType(int t)
          access the PreambleType property.
 
Methods inherited from class com.ibm.wbi.plugin.Editor
getMegType, getMonitors, isMonitors, processRejectedRequest
 
Methods inherited from class com.ibm.wbi.plugin.Meg
forwardRequest, getCondition, getEnabled, getName, getPlugin, getPriority, isEnabled, setCondition, setEnabled, setName, setPriority, setup, setup, setup, setup, threadManagerRun
 

Field Detail

BODY

public static final int BODY
specifies that the PreambleHTMLString should be added to the body of the document (the default).

JSCRIPT

public static final int JSCRIPT
specifies that the PreambleHTMLString should be added to the head of the document (useful for scripts).
Constructor Detail

AddPreambleEditor

public AddPreambleEditor()
construct an instance with a null PreambleHTMLString and a PreambleType of BODY.

AddPreambleEditor

public AddPreambleEditor(java.lang.String h)
construct an instance with the given PreambleHTMLString and a PreambleType of BODY.
Parameters:
h - the PreambleHTMLString

AddPreambleEditor

public AddPreambleEditor(java.lang.String h,
                         int type)
construct an instance with the given PreambleHTMLString and PreambleType.
Parameters:
h - the PreambleHTMLString
type - the PreambleType
Method Detail

getPreambleHTMLString

public java.lang.String getPreambleHTMLString()
access the PreambleHTMLString property.
Returns:
the PreambleHTMLString

setPreambleHtmlString

public void setPreambleHtmlString(java.lang.String h)
set the PreambleHTMLString property. This property specifies the actual HTML that will be added to the document. If the HTML is a script, the string should contain the <SCRIPT> tags and the PreambleType should be set to JSCRIPT.
Parameters:
h - the PreambleHTMLString

getPreambleType

public int getPreambleType()
access the PreambleType property.
Returns:
the PreambleType

setPreambleType

public void setPreambleType(int t)
access the PreambleType property. This property specifies whether the HTML should be added to the body (set property to BODY) or the head (set property to JSCRIPT) of the document.
Parameters:
t - the PreambleType

handleRequest

public void handleRequest(RequestEvent e)
                   throws RequestRejectedException
the method used by WBI to edit the document and add the HTML. Note that this method does not alter documents if they have a response code other than 200 (Ok). It does not check to ensure that the document is truly HTML and may mangle other document types.
Overrides:
handleRequest in class HttpEditor