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.
Dependencies: MbedJSONValue WIZnetInterface mbed
RequestHandler.cpp
00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <string.h> 00004 #include "RequestHandler.h" 00005 #include "MbedJSONValue.h" 00006 00007 extern MbedJSONValue WIZwikiREST; 00008 00009 void GetRequestHandler::handle(char* rest_uri, char *reply) 00010 { 00011 MbedJSONValue* tmpJson; 00012 00013 char* tok; 00014 char* last; 00015 00016 printf("GetRequestHandler():%s\r\n",rest_uri); 00017 00018 if(!strcmp(rest_uri, "/")) 00019 { 00020 strcpy(reply, WIZwikiREST.serialize().c_str()); 00021 return; 00022 } 00023 tok = strtok_r(rest_uri+1, "/", &last); // 20160226 00024 tmpJson = &WIZwikiREST; 00025 00026 while(tok) 00027 { 00028 printf("tok = %s \r\n", tok); // Name 00029 if(tmpJson->size() > 0) tmpJson = &((*tmpJson)[tok]); 00030 else 00031 { 00032 tmpJson = 0; 00033 break; 00034 } 00035 tok = strtok_r(0, "/", &last); // 20160226 00036 } 00037 if(tmpJson && tmpJson->size() > 0) 00038 { 00039 strcpy(reply, (*tmpJson).serialize().c_str()); 00040 } 00041 else 00042 { 00043 strcpy(reply, "{\"Result\" : \"No defined Resource\"}"); 00044 } 00045 return; 00046 } 00047 00048 void PutRequestHandler::handle(char* rest_uri, char *reply) 00049 { 00050 } 00051 00052 void DeleteRequestHandler::handle(char* rest_uri, char *reply) 00053 { 00054 } 00055 00056
Generated on Mon Jul 18 2022 15:28:46 by
1.7.2