public static class HTMLContext.Response
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HTMLContext.Response.MimeType
Common mime types for dynamic content
|
| Modifier and Type | Field and Description |
|---|---|
protected java.io.InputStream |
data
Data of the response, may be null.
|
protected java.util.Map<java.lang.String,java.lang.String> |
header
Headers for the HTTP response.
|
protected java.lang.String |
mimeType
MIME type of content, e.g.
|
protected int |
status
HTTP status code after processing, e.g. "200 OK", HTTP_OK
|
| Constructor and Description |
|---|
Response(int status,
java.lang.String origMimeType,
java.io.InputStream data)
Creates a new HTTP-response with the designated status, MIME-type and data.
|
Response(int status,
java.lang.String mimeType,
java.lang.String txt)
Convenience method that creates a HTTP-response by wrapping the designated
String by an InputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds the designated line to the header of this HTTP-response.
|
java.io.InputStream |
getData()
Returns the response data.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeader()
Returns the additional response headers.
|
java.lang.String |
getMimeType()
Returns the mime type of the response.
|
int |
getStatus()
Return the HTTP status code of the response.
|
protected int status
protected java.lang.String mimeType
protected java.io.InputStream data
protected java.util.Map<java.lang.String,java.lang.String> header
public Response(int status,
java.lang.String origMimeType,
java.io.InputStream data)
status - The HTTP-status of the response to create.origMimeType - The MIME-type of the HTTP-response to create.
null is interpreted as
HTMLContext.Response.MimeType.MIME_PLAINTEXT.data - The contents of the HTTP-response to create.public Response(int status,
java.lang.String mimeType,
java.lang.String txt)
String by an InputStream.status - The HTTP-status of the response to create.mimeType - The MIME-type of the HTTP-response to create.txt - The contents of the HTTP-response to create.public void addHeader(java.lang.String name,
java.lang.String value)
name - The name of the header-field to add to this HTTP-response.value - The value of the header-field to add to this HTTP-response.public int getStatus()
public java.lang.String getMimeType()
public java.io.InputStream getData()
public java.util.Map<java.lang.String,java.lang.String> getHeader()