Class CefriumContentResponse
java.lang.Object
com.cefrium.CefriumContentResponse
The answer of a
CefriumContentServer: status, MIME type, headers
and a body stream. The SDK reads the stream on a background thread and
closes it.-
Constructor Summary
ConstructorsConstructorDescriptionCefriumContentResponse(String mimeType, InputStream body) A200 OKresponse. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()longThe body length, or -1 when unknown.A header set on this response, by name in any case, ornull.A copy of the headers set on this response; names compare in any case.intstatic CefriumContentResponseA200 OKtext response, UTF-8.setCharset(String charset) Sets the charset of a text body, e.g.setContentLength(long length) Sets the body length in bytes, when known.Sets a response header, replacing one of the same name.Sets the status code and reason phrase (default200 OK).
-
Constructor Details
-
CefriumContentResponse
A200 OKresponse.- Parameters:
mimeType- The MIME type, e.g.text/html; seeCefriumContentServers.mimeTypeOf(String)to derive it from a path.body- The body, read to its end;nullfor none.
-
-
Method Details
-
ofText
A200 OKtext response, UTF-8. -
setStatus
Sets the status code and reason phrase (default200 OK). -
setCharset
Sets the charset of a text body, e.g.utf-8. -
setHeader
Sets a response header, replacing one of the same name. Content-Type and Content-Length come from the MIME type, charset and length. -
setContentLength
Sets the body length in bytes, when known. A known length lets the page seek: Range requests are answered from it (media, large files). -
getStatus
public int getStatus() -
getReason
-
getMimeType
-
getCharset
-
getHeader
-
getHeaders
-
getBody
-
getContentLength
public long getContentLength()The body length, or -1 when unknown.
-