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
-
addExtraHeader(String, String)
- Adds an extra meta-information header to the response.
-
containsExtraHeader(String)
- Returns true if the response contains the named
extra header.
-
endErrorResponse()
- Finish off an HTTP "500 Server Error" response that was started
with startErrorResponse.
-
extraHeaderCount()
- Returns the number of extra headers in the response.
-
extraHeaderNames()
- Returns an ExtraHeaderEnumeration of the extra header
names in the response.
-
getExtraHeader(String)
- Gets the value of the named response extra header, or null if it
is not present.
-
print(String)
- Prints a string
-
print(char[])
- Prints an array of characters.
-
print(StringBuffer)
- Prints a string buffer.
-
print(char)
- Prints a character.
-
print(int)
- Prints an integer.
-
print(long)
- Prints a long.
-
print(float)
- Prints a float.
-
print(double)
- Prints a double.
-
print(boolean)
- Prints a boolean.
-
print(Object)
- Prints an object.
-
println(String)
- Prints a string followed by a line terminator.
-
println(StringBuffer)
- Prints a string buffer followed by a line terminator.
-
println()
- Prints a line terminator
-
println(char[])
- Prints an array of characters followed by a line terminator.
-
println(char)
- Prints a character followed by a line terminator.
-
println(int)
- Prints an integer followed by a line terminator.
-
println(long)
- Prints a long followed by a line terminator.
-
println(float)
- Prints a float followed by a line terminator.
-
println(double)
- Prints a double followed by a line terminator.
-
println(boolean)
- Prints a boolean followed by a line terminator.
-
println(Object)
- Prints an object followed by a line terminator.
-
setContentType(String)
- Sets the media content type for the response body.
-
startErrorResponse()
- Start an HTTP "500 server error" response.
-
write(int)
- Writes a byte of data
-
write(byte[])
- Writes an array of bytes
-
write(byte[], int, int)
- Writes a sub-array of bytes
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
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
extraHeaderCount
public static int extraHeaderCount()
- Returns the number of extra headers in the response.
extraHeaderNames
public static ExtraHeaderEnumeration extraHeaderNames()
- Returns an ExtraHeaderEnumeration of the extra header
names in the response.
- See Also:
- ExtraHeaderEnumeration
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.
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.
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
endErrorResponse
public static void endErrorResponse()
- Finish off an HTTP "500 Server Error" response that was started
with startErrorResponse.
- See Also:
- startErrorResponse
write
public static void write(int b)
- Writes a byte of data
- Parameters:
- b - the byte to be written
write
public static void write(byte b[])
- Writes an array of bytes
- Parameters:
- b - the data to be written
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
print
public static void print(String s)
- Prints a string
- Parameters:
- s - the string
print
public static void print(char s[])
- Prints an array of characters.
- Parameters:
- s - the array of chars
print
public static void print(StringBuffer sb)
- Prints a string buffer.
- Parameters:
- sb - the StringBuffer object
print
public static void print(char c)
- Prints a character.
- Parameters:
- c - the character to be printed
print
public static void print(int i)
- Prints an integer.
- Parameters:
- i - the integer to be printed
print
public static void print(long l)
- Prints a long.
- Parameters:
- l - the long to be printed
print
public static void print(float f)
- Prints a float.
- Parameters:
- f - the float to be printed
print
public static void print(double d)
- Prints a double.
- Parameters:
- d - the double to be printed
print
public static void print(boolean b)
- Prints a boolean.
- Parameters:
- b - the boolean to be printed
print
public static void print(Object o)
- Prints an object.
- Parameters:
- o - the object to be printed
println
public static void println(String s)
- Prints a string followed by a line terminator.
- Parameters:
- s - the string to be printed
println
public static void println(StringBuffer sb)
- Prints a string buffer followed by a line terminator.
- Parameters:
- sb - the string buffer
println
public static void println()
- Prints a line terminator
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
println
public static void println(char c)
- Prints a character followed by a line terminator.
- Parameters:
- c - the character to be printed
println
public static void println(int i)
- Prints an integer followed by a line terminator.
- Parameters:
- i - the integer to be printed
println
public static void println(long l)
- Prints a long followed by a line terminator.
- Parameters:
- l - the long to be printed
println
public static void println(float f)
- Prints a float followed by a line terminator.
- Parameters:
- f - the float to be printed
println
public static void println(double d)
- Prints a double followed by a line terminator.
- Parameters:
- d - the double to be printed
println
public static void println(boolean b)
- Prints a boolean followed by a line terminator.
- Parameters:
- b - the boolean to be printed
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