com.ibm.wbi.http.beans
Class ResourceGenerator

com.ibm.wbi.plugin.Meg
  |
  +--com.ibm.wbi.plugin.Generator
        |
        +--com.ibm.wbi.http.plugin.HttpGenerator
              |
              +--com.ibm.wbi.http.beans.FourStepHttpGenerator
                    |
                    +--com.ibm.wbi.http.beans.ResourceGenerator

public class ResourceGenerator
extends FourStepHttpGenerator

A Generator for delivering the contents of a resource to the client. This class has several properties (some of which are defined by the superclass). For normal operation, the most used properties are ResourceName and ContentType. These specify the name of the resource to be served and the MIME type to be reported back to the browser.

By default, the browser is allowed to cache the document. This property can be adjusted with the setCache(boolean) and isCache() methods of the superclass.


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright information
 
Fields inherited from class com.ibm.wbi.http.plugin.HttpGenerator
COPYRIGHT, http
 
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
ResourceGenerator()
          Construct an instance with a null resourcename and "text/html" ContentType.
ResourceGenerator(java.lang.String resourcename)
          Construct an instance with the given ResourceName and "text/html" ContentType.
ResourceGenerator(java.lang.String resourcename, boolean bufferme)
          Construct an instance with the given ResourceName and ContentType.
ResourceGenerator(java.lang.String resourcename, java.lang.String type)
          Construct an instance with the given ResourceName and ContentType.
ResourceGenerator(java.lang.String resourcename, java.lang.String type, boolean bufferme)
          Construct an instance with the given ResourceName and ContentType.
 
Method Summary
 boolean getBufferp()
          Access the Bufferp property
 java.lang.String getResourceName()
          Access the ResourceName property
 void setBufferp(boolean b)
          Set the Bufferp property,
 void setResourceName(java.lang.String fn)
          Set the ResourceName property with the name of the resource to be served,
protected  boolean verify(RequestEvent e)
          Determine if resource exists.
protected  void writeContent(RequestEvent e)
          Write the content to the output stream.
 
Methods inherited from class com.ibm.wbi.http.beans.FourStepHttpGenerator
getHeader, handleRequest, initialize
 
Methods inherited from class com.ibm.wbi.http.plugin.HttpGenerator
add, addCookie, getContentType, getHttpResponse, getHttpResponseString, getResponseCode, getResponseText, isCache, produceHeader, set, setCache, setContentLength, setContentType, setResponseCode, setResponseText, setServer, writeHeader
 
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
Constructor Detail

ResourceGenerator

public ResourceGenerator()
Construct an instance with a null resourcename and "text/html" ContentType.

ResourceGenerator

public ResourceGenerator(java.lang.String resourcename)
Construct an instance with the given ResourceName and "text/html" ContentType.
Parameters:
filename - The name of the file to be served.
See Also:
setResourceName(String)

ResourceGenerator

public ResourceGenerator(java.lang.String resourcename,
                         java.lang.String type)
Construct an instance with the given ResourceName and ContentType.
Parameters:
resourcename - The name of the resource to be served
type - The MIME type to be reported back to the browser.
See Also:
setResourceName(String)

ResourceGenerator

public ResourceGenerator(java.lang.String resourcename,
                         boolean bufferme)
Construct an instance with the given ResourceName and ContentType.
Parameters:
resourcename - The name of the resource to be served
bufferme - Whether to buffer the resource the first time it is accessed (for easy future access).
See Also:
setResourceName(String)

ResourceGenerator

public ResourceGenerator(java.lang.String resourcename,
                         java.lang.String type,
                         boolean bufferme)
Construct an instance with the given ResourceName and ContentType.
Parameters:
resourcename - The name of the resource to be served
type - The MIME type to be reported back to the browser.
bufferme - Whether to bufer the resource the first time it is accessed (for easy future access).
See Also:
setResourceName(String)
Method Detail

setResourceName

public void setResourceName(java.lang.String fn)
Set the ResourceName property with the name of the resource to be served,
Parameters:
fn - The Resource Name

getResourceName

public java.lang.String getResourceName()
Access the ResourceName property
Returns:
The Resource name

setBufferp

public void setBufferp(boolean b)
Set the Bufferp property,
Parameters:
b - Whether to buffer the resource data the first time it is accessed

getBufferp

public boolean getBufferp()
Access the Bufferp property
Returns:
The Bufferp Bit

verify

protected boolean verify(RequestEvent e)
Determine if resource exists. If does, then accept request.
Parameters:
e - The request event.
Returns:
Accept request?
Overrides:
verify in class FourStepHttpGenerator

writeContent

protected void writeContent(RequestEvent e)
Write the content to the output stream. Buffer the data as needed.
Overrides:
writeContent in class FourStepHttpGenerator