com.ibm.wbi.protocol.http.beans
Class AddPreambleEditor
com.ibm.wbi.Meg
|
+--com.ibm.wbi.Editor
|
+--com.ibm.wbi.protocol.http.HttpEditor
|
+--com.ibm.wbi.protocol.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). |
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. |
Methods inherited from class com.ibm.wbi.Meg |
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup |
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).
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 PreambleHTMLStringtype
- the PreambleType
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
- Following copied from class:
com.ibm.wbi.protocol.http.HttpEditor
- Parameters:
event
- The request event with an input and output stream.- Throws:
RequestRejectedException
- If rejecting request, this
must be thrown before the first write()
is
made to the output stream.java.io.Exception
- can be thrown if an exception was generated
by the Meg while processing the MegInput/OutputStreams.