Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Public Member Functions | |
bool | sendString (const String &text) |
bool | hasHeader (const String &name) SMING_DEPRECATED |
void | redirect (const String &location) SMING_DEPRECATED |
void | forbidden () SMING_DEPRECATED |
void | notFound () SMING_DEPRECATED |
HttpResponse * | setContentType (const String &type) |
HttpResponse * | setContentType (enum MimeType type) |
HttpResponse * | setCookie (const String &name, const String &value) |
HttpResponse * | setHeader (const String &name, const String &value) |
HttpResponse * | setCache (int maxAgeSeconds=3600, bool isPublic=false) |
HttpResponse * | setAllowCrossDomainOrigin (const String &controlAllowOrigin) |
bool | sendFile (String fileName, bool allowGzipFileCheck=true) |
Send file by name. More... | |
bool | sendTemplate (TemplateStream *newTemplateInstance) |
Parse and send template file. More... | |
bool | sendJsonObject (JsonObjectStream *newJsonStreamInstance) SMING_DEPRECATED |
Build and send JSON string. More... | |
bool | sendDataStream (IDataSourceStream *newDataStream, enum MimeType type) |
Send data from the given stream object. More... | |
bool | sendDataStream (IDataSourceStream *newDataStream, const String &reqContentType=nullptr) |
Send data from the given stream object. More... | |
String | getBody () |
Get response body as a string. More... | |
void | reset () |
reset response so it can be re-used More... | |
void | setBuffer (ReadWriteStream *buffer) |
Called by connection to specify where incoming response data is written. More... | |
void | freeStreams () |
release allocated stream memory More... | |
Public Attributes | |
unsigned | code = HTTP_STATUS_OK |
The HTTP status response code. More... | |
HttpHeaders | headers |
ReadWriteStream * | buffer = nullptr |
Internal stream for storing strings and receiving responses. More... | |
IDataSourceStream * | stream = nullptr |
The body stream. More... | |
|
inline |
response.code = HTTP_STATUS_FORBIDDEN
instead void HttpResponse::freeStreams | ( | ) |
release allocated stream memory
String HttpResponse::getBody | ( | ) |
|
inline |
headers.contains()
instead
|
inline |
response.code = HTTP_STATUS_NOT_FOUND
instead
|
inline |
headers[HTTP_HEADER_LOCATION]
instead void HttpResponse::reset | ( | ) |
reset response so it can be re-used
|
inline |
Send data from the given stream object.
newDataStream | |
type |
false | on error |
bool HttpResponse::sendDataStream | ( | IDataSourceStream * | newDataStream, |
const String & | reqContentType = nullptr |
||
) |
Send data from the given stream object.
newDataStream | |
reqContentType |
on | error returns false and stream will have been destroyed so any external references to it must be invalidated. |
bool HttpResponse::sendFile | ( | String | fileName, |
bool | allowGzipFileCheck = true |
||
) |
Send file by name.
fileName | |
allowGzipFileCheck | If true, check file extension to see if content commpressed |
bool |
bool HttpResponse::sendJsonObject | ( | JsonObjectStream * | newJsonStreamInstance | ) |
Build and send JSON string.
response.sendDataStream(stream, MIME_JSON)
instead bool HttpResponse::sendTemplate | ( | TemplateStream * | newTemplateInstance | ) |
Parse and send template file.
newTemplateInstance |
bool |
void HttpResponse::setBuffer | ( | ReadWriteStream * | buffer | ) |
Called by connection to specify where incoming response data is written.
buffer |
ReadWriteStream* HttpResponse::buffer = nullptr |
Internal stream for storing strings and receiving responses.
unsigned HttpResponse::code = HTTP_STATUS_OK |
The HTTP status response code.
IDataSourceStream* HttpResponse::stream = nullptr |
The body stream.