|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcx.ath.matthew.cgi.CGI
public abstract class CGI
This is the main class you have to extend with your CGI program. You should implement the cgi() method.
| Constructor Summary | |
|---|---|
CGI()
|
|
| Method Summary | |
|---|---|
protected abstract void |
cgi(java.util.Map POST,
java.util.Map GET,
java.util.Map ENV,
java.util.Map COOKIES,
java.lang.String[] params)
Override this method in your CGI program. |
void |
doCGI(java.lang.String[] args)
This method sets up all the CGI variables and calls the cgi() method, then writes out the page data. |
void |
flush()
Flushes the output. |
java.io.OutputStream |
getOutputStream()
This will return an OutputStream that you can write data directly to. |
void |
header(java.lang.String variable,
java.lang.String value)
Called by CGIs to send a header to the output |
void |
out(byte[] data)
Called by CGIs to send byte data to the output. |
void |
out(java.lang.String data)
Called by CGIs to send a string to the output. |
void |
setcookie(java.lang.String variable,
java.lang.String value)
Sets a Cookie in the web browser. |
void |
setcookie(java.lang.String variable,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.util.Date expires,
boolean secure)
Sets a Cookie in the web browser, with extended attributes. |
protected void |
setErrorHandler(CGIErrorHandler handler)
Sets a custom exception handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CGI()
| Method Detail |
|---|
public final void header(java.lang.String variable,
java.lang.String value)
throws CGIHeaderSentException
variable - The header variable to set.value - The value of the variable.
CGIHeaderSentException - if the headers have already been sent.flush()
public final void setcookie(java.lang.String variable,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.util.Date expires,
boolean secure)
throws CGIHeaderSentException
variable - The cookie variable to set.value - The value of the variable.path - The path that the cookie will be returned for.domain - The domain that the cookie will be returned for.expires - The expiry date of the cookie.secure - Will only send the cookie over HTTPS if this is true.
CGIHeaderSentException - if the headers have already been sent.flush(),
header(java.lang.String, java.lang.String)
public final void setcookie(java.lang.String variable,
java.lang.String value)
throws CGIHeaderSentException
variable - The cookie variable to set.value - The value of the variable.
CGIHeaderSentException - if the headers have already been sent.flush(),
header(java.lang.String, java.lang.String)
public final void out(byte[] data)
throws CGIInvalidContentFormatException
data - The page data.
CGIInvalidContentFormatException - if text data has already been sent.flush()
public final void out(java.lang.String data)
throws CGIInvalidContentFormatException
data - The page data.
CGIInvalidContentFormatException - if raw data has already been sent.flush()
public final java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOExceptionout(byte[])
public final void flush()
throws java.io.IOException
java.io.IOExceptionheader(java.lang.String, java.lang.String)protected final void setErrorHandler(CGIErrorHandler handler)
handler - The new exception handler
protected abstract void cgi(java.util.Map POST,
java.util.Map GET,
java.util.Map ENV,
java.util.Map COOKIES,
java.lang.String[] params)
throws java.lang.Exception
POST - A Map of variable =$gt; value for the POST variables.GET - A Map of variable =$gt; value for the GET variables.ENV - A Map of variable =$gt; value for the Webserver environment variables.COOKIES - A Map of variable =$gt; value for the browser-sent cookies.params - An array of parameters passed to the CGI (GET with no variable assignments)
java.lang.Exception - You can throw anything, it will be caught by the error handler.public final void doCGI(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||