fixed with new libs

Dependents:   SmartRemote WifiFlexManager SmartRemote E7

Fork of HTTPServer by Ollie Milton

Committer:
leihen
Date:
Tue May 28 01:56:14 2013 +0000
Revision:
3:d6224049b3bf
First beta version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
leihen 3:d6224049b3bf 1 /* HTTPFsRequestHandler.h */
leihen 3:d6224049b3bf 2 /*
leihen 3:d6224049b3bf 3 Copyright (c) 2013 Henry Leinen (henry[dot]leinen [at] online [dot] de)
leihen 3:d6224049b3bf 4
leihen 3:d6224049b3bf 5 Permission is hereby granted, free of charge, to any person obtaining a copy
leihen 3:d6224049b3bf 6 of this software and associated documentation files (the "Software"), to deal
leihen 3:d6224049b3bf 7 in the Software without restriction, including without limitation the rights
leihen 3:d6224049b3bf 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
leihen 3:d6224049b3bf 9 copies of the Software, and to permit persons to whom the Software is
leihen 3:d6224049b3bf 10 furnished to do so, subject to the following conditions:
leihen 3:d6224049b3bf 11
leihen 3:d6224049b3bf 12 The above copyright notice and this permission notice shall be included in
leihen 3:d6224049b3bf 13 all copies or substantial portions of the Software.
leihen 3:d6224049b3bf 14
leihen 3:d6224049b3bf 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
leihen 3:d6224049b3bf 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
leihen 3:d6224049b3bf 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
leihen 3:d6224049b3bf 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
leihen 3:d6224049b3bf 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
leihen 3:d6224049b3bf 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
leihen 3:d6224049b3bf 21 THE SOFTWARE.
leihen 3:d6224049b3bf 22 */
leihen 3:d6224049b3bf 23 #ifndef __HTTPFSREQUESTHANDLER_H__
leihen 3:d6224049b3bf 24 #define __HTTPFSREQUESTHANDLER_H__
leihen 3:d6224049b3bf 25
leihen 3:d6224049b3bf 26 #include "mbed.h"
leihen 3:d6224049b3bf 27 #include "HTTPRequestHandler.h"
leihen 3:d6224049b3bf 28
leihen 3:d6224049b3bf 29 #include <map>
leihen 3:d6224049b3bf 30 #include <string>
leihen 3:d6224049b3bf 31
leihen 3:d6224049b3bf 32 class HTTPFsRequestHandler : public HTTPRequestHandler
leihen 3:d6224049b3bf 33 {
leihen 3:d6224049b3bf 34 std::string m_rootPath;
leihen 3:d6224049b3bf 35 std::string m_localPath;
leihen 3:d6224049b3bf 36
leihen 3:d6224049b3bf 37 public:
leihen 3:d6224049b3bf 38 HTTPFsRequestHandler(const char* roottPath, const char* localPath, HTTPConnection::HTTPMessage& Msg, TCPSocketConnection& Tcp);
leihen 3:d6224049b3bf 39 virtual ~HTTPFsRequestHandler();
leihen 3:d6224049b3bf 40
leihen 3:d6224049b3bf 41 static inline HTTPRequestHandler* create(const char* rootPath, const char* localPath, HTTPConnection::HTTPMessage& msg, TCPSocketConnection& tcp) { return new HTTPFsRequestHandler(rootPath, localPath, msg, tcp); }
leihen 3:d6224049b3bf 42
leihen 3:d6224049b3bf 43 /** Handler function to serve GET requests
leihen 3:d6224049b3bf 44 */
leihen 3:d6224049b3bf 45 virtual int handleGetRequest();
leihen 3:d6224049b3bf 46
leihen 3:d6224049b3bf 47 static std::map<const char*, const char*> m_fsMap;
leihen 3:d6224049b3bf 48 static void mount(const char* requestPath, const char* localPath) { m_fsMap[requestPath] = localPath; }
leihen 3:d6224049b3bf 49 };
leihen 3:d6224049b3bf 50 #endif // __HTTPFSREQUESTHANDLER_H__