|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--dfischer.femtowebserver.httpd.HttpResponse
Sets the Weblet HTTP response data (server response).
Use the methods print() and println() to transmit ASCII-content like HTML data to the agent (browser). For all other type of content, especially for binary data, you must use the method setContent(). Take into consideration that if you use setContent(), you must also set the right MIME type of your content data with the method setContentType().
More information about the HTTP protocol is available at http://www.w3.org
HttpdWebletInterface,
HttpdProperties| Field Summary | |
static java.lang.String |
HTTP_DEFAULT_CONTENT_TYPE
The default content type for the Weblet response is "TEXT/HTML". |
static int |
HTTP_DEFAULT_STATUS_CODE
The default HTTP status code for a Weblet is 200. |
static java.lang.String |
HTTP_DEFAULT_STATUS_TEXT
The default HTTP status text for a Weblet is "OK". |
static java.lang.String |
HTTP_VERSION
The Femto Web Server supports only the HTTP protocol version 1.0 . |
| Method Summary | |
void |
print(java.lang.String text)
Appends (text) content to HTTP response. |
void |
println()
Appends a <CR><NL> to the HTTP response. |
void |
println(java.lang.String text)
Appends text content to the HTTP response and adds a <CR><NL>. |
void |
setAdditionalHeaderField(java.lang.String headerFieldName,
java.lang.String headerFieldValue)
Allows to set additional fields inside the HTTP response header. |
void |
setContent(byte[] content)
Sets the content data of the HTTP response. |
void |
setContentType(java.lang.String mimeContentType)
Sets the MIME content type of the content data. |
void |
setError(int httpStatus,
java.lang.String httpStatusText)
Sets the HTTP status code and the HTTP status text, and appends a small HTML error message as content. |
void |
setStatus(int httpStatus,
java.lang.String httpStatusText)
Sets the HTTP status code and the HTTP status text. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String HTTP_VERSION
public static final int HTTP_DEFAULT_STATUS_CODE
setStatus(int, java.lang.String),
setError(int, java.lang.String)public static final java.lang.String HTTP_DEFAULT_STATUS_TEXT
setStatus(int, java.lang.String),
setError(int, java.lang.String)public static final java.lang.String HTTP_DEFAULT_CONTENT_TYPE
setContentType(java.lang.String)| Method Detail |
public void setStatus(int httpStatus,
java.lang.String httpStatusText)
httpStatus - HTTP status codehttpStatusText - HTTP status text, or set this value to null, if you don't want to transfer a status textsetError(int, java.lang.String)
public void setError(int httpStatus,
java.lang.String httpStatusText)
Important Hint: all content data that you have set by print(), println() or setContent() and setContentType() will be overwritten.
httpStatus - HTTP status codehttpStatusText - HTTP status text (must not be null).setStatus(int, java.lang.String)
public void setAdditionalHeaderField(java.lang.String headerFieldName,
java.lang.String headerFieldValue)
headerFieldName - the header field name to addheaderFieldValue - the value of the header fieldpublic void setContentType(java.lang.String mimeContentType)
mimeContentType - the MIME content type of the content datasetContent(byte[])public void setContent(byte[] content)
Important Hint: this method will overwrite all content data of the methods print() and println(). Consider also that you must set the appropriate content type if you use this method.
content - content data of the HTTP responsesetContentType(java.lang.String),
print(java.lang.String),
println()public void print(java.lang.String text)
Important Hint: this method will clear all content that have already set with setContent().
text - text to append to the response content (must not be null)println(String),
setContent(byte[])public void println()
Important Hint: this method will clear all content that have already set with setContent().
print(java.lang.String),
println(String),
setContent(byte[])public void println(java.lang.String text)
Important Hint: this method will clear all content that have already set with setContent().
text - text to append to the response content (must not be null)print(java.lang.String),
println(),
setContent(byte[])
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||