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: mbed NyFileSystems mbed-rtos libMiMic
main.cpp
- Committer:
- nyatla
- Date:
- 2013-04-09
- Revision:
- 3:77431c2bd9cb
- Parent:
- 2:28fd59d6be76
- Child:
- 4:0a280ed0a848
File content as of revision 3:77431c2bd9cb:
#include "mimic.h"
/**
* local filesystem support.
*/
LocalFileSystem lf("local");
/**
* MiMic RemoteMCU httpd.<br/>
* <p>Service list</p>
* <pre>
* /local/ - mbed LocalFileSystem
* </pre>
*/
class LfsHttpd:public MiMic::Httpd
{
private:
ModLocalFileSystem modurl; //basic URL parser
public:
LfsHttpd():Httpd(80)
{
//bind local file system path to /local/*
modurl.setParam("local");
}
virtual void onRequest(HttpdConnection& i_connection)
{
//call ModUrl module.
if(!this->modurl.execute(i_connection)){
//send 430
i_connection.sendHeader(403,"text/html",NULL);
i_connection.sendBodyF("<html><body>403 Forbidden</body></html>");
return;
}
return;
}
};
int main()
{
NetConfig cfg; //create network configulation
Net net(cfg); //create a net instance.
LfsHttpd httpd; //create a httpd instance.
httpd.loop(); //start httpd loop.
return 0;
}