com.ibm.wbi.http.plugin
Class HttpGenerator

com.ibm.wbi.plugin.Meg
  |
  +--com.ibm.wbi.plugin.Generator
        |
        +--com.ibm.wbi.http.plugin.HttpGenerator
Direct Known Subclasses:
CgiGenerator, FourStepHttpGenerator, MultipleCgiGenerator, MultipleFileGenerator, PutGenerator

public abstract class HttpGenerator
extends Generator

The abstract base class for Generators producing HTTP responses. This class simply contains an HttpResponse object and provides methods for manipulating that object. The object is not automatically used for producing an HTTP response, but is available for use by subclasses when they need to produce a response.

See Also:
HttpResponse

Field Summary
static java.lang.String COPYRIGHT
          IBM copyright information
protected  HttpResponse http
          An object for manipulating the response that will ultimately be sent back to the browser.
 
Fields inherited from class com.ibm.wbi.plugin.Generator
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.plugin.Meg
COPYRIGHT, EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
HttpGenerator()
          Construct a default HTTP Generator.
HttpGenerator(java.lang.String name, java.lang.String condition, int priority)
          Constructs a new HTTP generator with the specified characteristics and is enabled.
HttpGenerator(java.lang.String name, java.lang.String condition, int priority, boolean enabled)
          Constructs a new HTTP generator with the specified characteristics.
 
Method Summary
 void add(java.lang.String key, java.lang.String value)
          Add an arbitrary key/value pair of the HTTP Response object.
 void addCookie(java.lang.String name, java.lang.String value, java.util.Date expires, java.lang.String domain, java.lang.String path, boolean secure)
          Add a cookie to the HTTP Response object.
 java.lang.String getContentType()
          Get the ContentType property of the HTTP Response object.
 HttpResponse getHttpResponse()
          Access the HTTP Response object.
 java.lang.String getHttpResponseString()
          Convert the HTTP Response object into an HTTP response string.
 int getResponseCode()
          Get the ResponseCode property of the HTTP Response object.
 java.lang.String getResponseText()
          Get the ResponseText property of the HTTP Response object.
abstract  void handleRequest(RequestEvent e)
          The method used by Proxy to generate the document.
 boolean isCache()
          Access the Cache property of the HTTP Response object.
 java.lang.String produceHeader()
          Synonymous to getHTTPResponseString().
 void set(java.lang.String key, java.lang.String value)
          Set an arbitrary key/value pair of the HTTP Response object.
 void setCache(boolean c)
          Set the Cache property of the HTTP Response object.
 void setContentLength(long cl)
          Set the ContentLength property of the HTTP Response object.
 void setContentType(java.lang.String ct)
          Set the ContentType property of the HTTP Response object.
 void setResponseCode(int c)
          Set the ResponseCode property of the HTTP Response object.
 void setResponseText(java.lang.String t)
          Set the ResponseText property of the HTTP Response object.
 void setServer(java.lang.String s)
          Set the Server property of the HTTP Response object.
 void writeHeader(RequestEvent e)
          Write the HTTP Response to the given RequestEvent's output stream.
 
Methods inherited from class com.ibm.wbi.plugin.Generator
getMegType
 
Methods inherited from class com.ibm.wbi.plugin.Meg
forwardRequest, getCondition, getEnabled, getName, getPlugin, getPriority, isEnabled, processRejectedRequest, setCondition, setEnabled, setName, setPriority, setup, setup, setup, setup, threadManagerRun
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
IBM copyright information

http

protected HttpResponse http
An object for manipulating the response that will ultimately be sent back to the browser. This object is manipulated by the various methods of this class. It is then available for use by subclasses which implement the handleRequest(RequestEvent) method. Keep one universal copy in case the derived Generator always has the same HTTP info
Constructor Detail

HttpGenerator

public HttpGenerator()
Construct a default HTTP Generator.

HttpGenerator

public HttpGenerator(java.lang.String name,
                     java.lang.String condition,
                     int priority)
Constructs a new HTTP generator with the specified characteristics and is enabled.
Parameters:
name - The name of the generator.
condition - The condition under which this generator should be invoked.
priority - The priority of the generator incase of a condition tie.

HttpGenerator

public HttpGenerator(java.lang.String name,
                     java.lang.String condition,
                     int priority,
                     boolean enabled)
Constructs a new HTTP generator with the specified characteristics.
Parameters:
name - The name of the generator.
condition - The condition under which this generator should be invoked.
priority - The priority of the gemerator incase of a condition tie.
enabled - true if enabled.
Method Detail

getHttpResponse

public HttpResponse getHttpResponse()
Access the HTTP Response object.
Returns:
The response.

getHttpResponseString

public java.lang.String getHttpResponseString()
Convert the HTTP Response object into an HTTP response string.
Returns:
The response.

setContentType

public void setContentType(java.lang.String ct)
Set the ContentType property of the HTTP Response object.
Parameters:
ct - The ContentType.
See Also:
HttpBase.setContentType(java.lang.String)

getContentType

public java.lang.String getContentType()
Get the ContentType property of the HTTP Response object.
Returns:
the ContentType.
See Also:
HttpBase.getContentType()

setContentLength

public void setContentLength(long cl)
Set the ContentLength property of the HTTP Response object.
Parameters:
cl - The ContentLength.
See Also:
HttpBase.setContentLength(long)

set

public void set(java.lang.String key,
                java.lang.String value)
Set an arbitrary key/value pair of the HTTP Response object.
Parameters:
key - The key.
value - The value.
See Also:
HttpBase.set(java.lang.String, java.lang.String)

add

public void add(java.lang.String key,
                java.lang.String value)
Add an arbitrary key/value pair of the HTTP Response object.
Parameters:
key - The key.
value - The value.
See Also:
HttpBase.add(java.lang.String, java.lang.String)

addCookie

public void addCookie(java.lang.String name,
                      java.lang.String value,
                      java.util.Date expires,
                      java.lang.String domain,
                      java.lang.String path,
                      boolean secure)
Add a cookie to the HTTP Response object.
Parameters:
name - The name of the cookie.
date - The date it expires.
domain - The domain.
path - The path.
secure - Is secure?
See Also:
HttpResponse.addCookie(java.lang.String, java.lang.String, java.util.Date, java.lang.String, java.lang.String, boolean)

getResponseCode

public int getResponseCode()
Get the ResponseCode property of the HTTP Response object.
Returns:
The ResponseCode.
See Also:
HttpResponse.getResponseCode()

setResponseCode

public void setResponseCode(int c)
Set the ResponseCode property of the HTTP Response object.
Parameters:
c - The ResponseCode.
See Also:
HttpResponse.setResponseCode(int)

getResponseText

public java.lang.String getResponseText()
Get the ResponseText property of the HTTP Response object.
Returns:
The ResponseText.
See Also:
HttpResponse.getResponseText()

setResponseText

public void setResponseText(java.lang.String t)
Set the ResponseText property of the HTTP Response object.
Parameters:
t - The ResponseText.
See Also:
HttpResponse.setResponseText(java.lang.String)

produceHeader

public java.lang.String produceHeader()
Synonymous to getHTTPResponseString().
Returns:
The HTTP Response string.
See Also:
getHTTPResponseString

writeHeader

public void writeHeader(RequestEvent e)
Write the HTTP Response to the given RequestEvent's output stream.
Parameters:
e - Request event.

setServer

public void setServer(java.lang.String s)
Set the Server property of the HTTP Response object.
See Also:
HttpResponse.setServer(java.lang.String)

setCache

public void setCache(boolean c)
Set the Cache property of the HTTP Response object.
Parameters:
c - Cache property.
See Also:
HttpResponse.setCache(boolean)

isCache

public boolean isCache()
Access the Cache property of the HTTP Response object.
See Also:
HttpResponse.isCache()

handleRequest

public abstract void handleRequest(RequestEvent e)
                            throws RequestRejectedException,
                                   java.io.IOException
The method used by Proxy to generate the document. This method must be implemented by subclasses.
Overrides:
handleRequest in class Generator