Class WebSite.WinCGI.Response
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class WebSite.WinCGI.Response

java.lang.Object
   |
   +----WebSite.WinCGI.Response

public final class Response
extends Object

The Response class implements the WebSite Windows CGI/1.3 response information and methods. It is a purely static class and cannot be instantiated.

The standard line terminator for HTTP (and other Internet protocols) is CR-LF. The println methods here generate these line endings. This class implements most of the methods of the PrintStream class, but with proper line terminators and better error detection.

Author: Robert B. Denny
Version: 0.2 (experimental)

See Also:
Server, Client, Request, Form

Method Index

 o addExtraHeader(String, String)
Adds an extra meta-information header to the response.
 o containsExtraHeader(String)
Returns true if the response contains the named extra header.
 o endErrorResponse()
Finish off an HTTP "500 Server Error" response that was started with startErrorResponse.
 o extraHeaderCount()
Returns the number of extra headers in the response.
 o extraHeaderNames()
Returns an ExtraHeaderEnumeration of the extra header names in the response.
 o getExtraHeader(String)
Gets the value of the named response extra header, or null if it is not present.
 o print(String)
Prints a string
 o print(char[])
Prints an array of characters.
 o print(StringBuffer)
Prints a string buffer.
 o print(char)
Prints a character.
 o print(int)
Prints an integer.
 o print(long)
Prints a long.
 o print(float)
Prints a float.
 o print(double)
Prints a double.
 o print(boolean)
Prints a boolean.
 o print(Object)
Prints an object.
 o println(String)
Prints a string followed by a line terminator.
 o println(StringBuffer)
Prints a string buffer followed by a line terminator.
 o println()
Prints a line terminator
 o println(char[])
Prints an array of characters followed by a line terminator.
 o println(char)
Prints a character followed by a line terminator.
 o println(int)
Prints an integer followed by a line terminator.
 o println(long)
Prints a long followed by a line terminator.
 o println(float)
Prints a float followed by a line terminator.
 o println(double)
Prints a double followed by a line terminator.
 o println(boolean)
Prints a boolean followed by a line terminator.
 o println(Object)
Prints an object followed by a line terminator.
 o setContentType(String)
Sets the media content type for the response body.
 o startErrorResponse()
Start an HTTP "500 server error" response.
 o write(int)
Writes a byte of data
 o write(byte[])
Writes an array of bytes
 o write(byte[], int, int)
Writes a sub-array of bytes

Methods

 o containsExtraHeader
  public static boolean containsExtraHeader(String name)
Returns true if the response contains the named extra header.
Parameters:
name - The name (label) of the extra header
 o getExtraHeader
  public static String getExtraHeader(String name)
Gets the value of the named response extra header, or null if it is not present.
Parameters:
name - The name (label) of the extra header
 o extraHeaderCount
  public static int extraHeaderCount()
Returns the number of extra headers in the response.
 o extraHeaderNames
  public static ExtraHeaderEnumeration extraHeaderNames()
Returns an ExtraHeaderEnumeration of the extra header names in the response.
See Also:
ExtraHeaderEnumeration
 o setContentType
  public static void setContentType(String ct) throws IOException
Sets the media content type for the response body. The default is text/html, used for HTML responses. The call to this method must occur before any content is written/printed.
Parameters:
ct - the media content type, for example text/html
Throws: IOException
Thrown if you attempt to set the content type after using any of the methods that send content to the client.
 o addExtraHeader
  public static void addExtraHeader(String name,
                                    String value) throws IOException
Adds an extra meta-information header to the response. The call to this method must occur before any content is written/printed.

Example:

...addExtraHeader("X-Extra-Header", "meta info");
Parameters:
name - the extra header label (without the ':')
value - the extra header value
Throws: IOException
Thrown if you attempt to add an extra header after using any of the methods that send content to the client.
 o startErrorResponse
  public static void startErrorResponse()
Start an HTTP "500 server error" response. This method clears any data that may have been written to the output spoolfile and replaces it with the start of an HTTP "500 Server Error" response.
See Also:
endErrorResponse
 o endErrorResponse
  public static void endErrorResponse()
Finish off an HTTP "500 Server Error" response that was started with startErrorResponse.
See Also:
startErrorResponse
 o write
  public static void write(int b)
Writes a byte of data
Parameters:
b - the byte to be written
 o write
  public static void write(byte b[])
Writes an array of bytes
Parameters:
b - the data to be written
 o write
  public static void write(byte b[],
                           int off,
                           int len)
Writes a sub-array of bytes
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes to be written
 o print
  public static void print(String s)
Prints a string
Parameters:
s - the string
 o print
  public static void print(char s[])
Prints an array of characters.
Parameters:
s - the array of chars
 o print
  public static void print(StringBuffer sb)
Prints a string buffer.
Parameters:
sb - the StringBuffer object
 o print
  public static void print(char c)
Prints a character.
Parameters:
c - the character to be printed
 o print
  public static void print(int i)
Prints an integer.
Parameters:
i - the integer to be printed
 o print
  public static void print(long l)
Prints a long.
Parameters:
l - the long to be printed
 o print
  public static void print(float f)
Prints a float.
Parameters:
f - the float to be printed
 o print
  public static void print(double d)
Prints a double.
Parameters:
d - the double to be printed
 o print
  public static void print(boolean b)
Prints a boolean.
Parameters:
b - the boolean to be printed
 o print
  public static void print(Object o)
Prints an object.
Parameters:
o - the object to be printed
 o println
  public static void println(String s)
Prints a string followed by a line terminator.
Parameters:
s - the string to be printed
 o println
  public static void println(StringBuffer sb)
Prints a string buffer followed by a line terminator.
Parameters:
sb - the string buffer
 o println
  public static void println()
Prints a line terminator
 o println
  public static void println(char s[])
Prints an array of characters followed by a line terminator.
Parameters:
s - the array of characters to be printed
 o println
  public static void println(char c)
Prints a character followed by a line terminator.
Parameters:
c - the character to be printed
 o println
  public static void println(int i)
Prints an integer followed by a line terminator.
Parameters:
i - the integer to be printed
 o println
  public static void println(long l)
Prints a long followed by a line terminator.
Parameters:
l - the long to be printed
 o println
  public static void println(float f)
Prints a float followed by a line terminator.
Parameters:
f - the float to be printed
 o println
  public static void println(double d)
Prints a double followed by a line terminator.
Parameters:
d - the double to be printed
 o println
  public static void println(boolean b)
Prints a boolean followed by a line terminator.
Parameters:
b - the boolean to be printed
 o println
  public static void println(Object obj)
Prints an object followed by a line terminator.
Parameters:
obj - the object to be printed

All Packages  Class Hierarchy  This Package  Previous  Next  Index