Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HTTPRestHandler.h
00001 #ifndef HTTP_REST_HANDLER_H 00002 #define HTTP_REST_HANDLER_H 00003 00004 #include "mbed.h" 00005 #include "HTTPServer.h" 00006 #include "string.h" 00007 00008 #define RESP_LEN 1024 00009 00010 class HTTPRestData : public HTTPData { 00011 public: 00012 HTTPRestData() { 00013 memset(response, 0, RESP_LEN); 00014 }; 00015 00016 char response[RESP_LEN]; 00017 }; 00018 00019 // HTTP handler for RESTful requests 00020 class HTTPRestHandler : public HTTPHandler { 00021 public: 00022 HTTPRestHandler(const char *path) : HTTPHandler(path) { 00023 printf("HTTPRestHandler: %s\n", path); 00024 prefixLength= strlen(path); 00025 } 00026 00027 protected: 00028 int prefixLength; 00029 HTTPStatus doGet(char *resource, HTTPConnection *conn) const; 00030 HTTPStatus doPost(char *resource, HTTPConnection *conn) const; 00031 00032 virtual void reg(HTTPServer *server); 00033 virtual HTTPStatus init(HTTPConnection *conn) const; 00034 virtual HTTPHandle data(HTTPConnection *conn, void *data, int len) const; 00035 virtual HTTPHandle send(HTTPConnection *conn, int maxData) const; 00036 }; 00037 00038 #endif
Generated on Wed Jul 13 2022 23:42:33 by
1.7.2