EthernetNetIf Compatibility.
Dependents: XBeeWiFi_SPI_example
Fork of NetServicesSource by
Diff: services/http/server/impl/FSHandler.cpp
- Revision:
- 1:abb442332fa8
- Parent:
- 0:632c9925f013
- Child:
- 2:a4f97773c90f
--- a/services/http/server/impl/FSHandler.cpp Fri Jun 11 16:05:15 2010 +0000 +++ b/services/http/server/impl/FSHandler.cpp Mon Jun 14 10:33:54 2010 +0000 @@ -28,9 +28,6 @@ #define CHUNK_SIZE 512//128 -//LocalFileSystem local("webfs"); -//LocalFileSystem FSHandler_fs("webfs"); - FSHandler::FSHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket) : HTTPRequestHandler(rootPath, path, pTCPSocket), m_err404(false) {} @@ -41,11 +38,20 @@ DBG("\r\nHandler destroyed\r\n"); } +//static init +map<string,string> FSHandler::m_lFsPath = map<string,string>(); + +void FSHandler::mount(const string& fsPath, const string& rootPath) +{ + m_lFsPath[rootPath]=fsPath; +} + void FSHandler::doGet() { DBG("\r\nIn FSHandler::doGet()\r\n"); //FIXME: Translate path to local/path - m_fp = fopen(path().c_str(), "r"); //FIXME: if null, error 404 + string filePath = m_lFsPath[rootPath()] + path(); + m_fp = fopen(filePath.c_str(), "r"); //FIXME: if null, error 404 if(!m_fp) {