public abstract static class HttpServer.Response extends Object
| Constructor and Description |
|---|
Response(int statusCode,
String statusPhrase,
Map headerMap)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Map |
getHeaderMap()
Returns a map of key-value pairs representing HTTP response headers.
|
int |
getStatusCode()
Returns the 3-digit status code.
|
String |
getStatusPhrase()
Returns the status phrase.
|
abstract void |
writeBody(OutputStream out)
Implemented to generate the bytes in the body of the response.
|
void |
writeResponse(OutputStream out)
Writes this response to an output stream in a way suitable for
replying to the client.
|
public Response(int statusCode,
String statusPhrase,
Map headerMap)
statusCode - 3-digit status codestatusPhrase - text string passed to client along
with the status codeheaderMap - map of key-value pairs representing response
header information; should normally contain
at least a content-type keypublic int getStatusCode()
public String getStatusPhrase()
public Map getHeaderMap()
HttpServer.getHeader(java.util.Map, java.lang.String) utility method
can be used to interrogate the returned map.public abstract void writeBody(OutputStream out) throws IOException
out - destination stream for body bytesIOExceptionpublic void writeResponse(OutputStream out) throws IOException
writeBody(java.io.OutputStream)
is called.out - destination streamIOExceptionCopyright © 2008–2024. All rights reserved.