public static class NanoHTTPD.Response extends Object implements Closeable
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
NanoHTTPD.Response.IStatus |
static class |
NanoHTTPD.Response.Status
Some HTTP response status codes
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
Response(NanoHTTPD.Response.IStatus status,
String mimeType,
InputStream data,
long totalBytes)
Creates a fixed length response if totalBytes>=0, otherwise chunked.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHeader(String name,
String value)
Adds given line to the header.
|
void |
close() |
void |
closeConnection(boolean close)
Indicate to close the connection after the Response has been sent.
|
InputStream |
getData() |
String |
getHeader(String name) |
String |
getMimeType() |
NanoHTTPD.Method |
getRequestMethod() |
NanoHTTPD.Response.IStatus |
getStatus() |
boolean |
isCloseConnection() |
protected void |
printHeader(PrintWriter pw,
String key,
String value) |
protected void |
send(OutputStream outputStream)
Sends given response to the socket.
|
protected long |
sendContentLengthHeaderIfNotAlreadyPresent(PrintWriter pw,
long defaultSize) |
void |
setChunkedTransfer(boolean chunkedTransfer) |
void |
setData(InputStream data) |
void |
setGzipEncoding(boolean encodeAsGzip) |
void |
setKeepAlive(boolean useKeepAlive) |
void |
setMimeType(String mimeType) |
void |
setRequestMethod(NanoHTTPD.Method requestMethod) |
void |
setStatus(NanoHTTPD.Response.IStatus status) |
protected Response(NanoHTTPD.Response.IStatus status, String mimeType, InputStream data, long totalBytes)
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionpublic void closeConnection(boolean close)
close - true to hint connection closing, false to
let connection be closed by client.public boolean isCloseConnection()
true if connection is to be closed after this
Response has been sent.public InputStream getData()
public String getMimeType()
public NanoHTTPD.Method getRequestMethod()
public NanoHTTPD.Response.IStatus getStatus()
public void setGzipEncoding(boolean encodeAsGzip)
public void setKeepAlive(boolean useKeepAlive)
protected void send(OutputStream outputStream)
protected void printHeader(PrintWriter pw, String key, String value)
protected long sendContentLengthHeaderIfNotAlreadyPresent(PrintWriter pw, long defaultSize)
public void setChunkedTransfer(boolean chunkedTransfer)
public void setData(InputStream data)
public void setMimeType(String mimeType)
public void setRequestMethod(NanoHTTPD.Method requestMethod)
public void setStatus(NanoHTTPD.Response.IStatus status)
Copyright © 2019. All rights reserved.