An example HTTP Server library using new Ethernet Interface

Dependents:   HTMLServer_Sample

Committer:
mkilivan
Date:
Tue Dec 23 18:49:25 2014 +0000
Revision:
0:8e1971a883be
forked from http://developer.mbed.org/users/yueee_yt/code/giken9_HTMLServer_Sample/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mkilivan 0:8e1971a883be 1
mkilivan 0:8e1971a883be 2 /*
mkilivan 0:8e1971a883be 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
mkilivan 0:8e1971a883be 4
mkilivan 0:8e1971a883be 5 Permission is hereby granted, free of charge, to any person obtaining a copy
mkilivan 0:8e1971a883be 6 of this software and associated documentation files (the "Software"), to deal
mkilivan 0:8e1971a883be 7 in the Software without restriction, including without limitation the rights
mkilivan 0:8e1971a883be 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
mkilivan 0:8e1971a883be 9 copies of the Software, and to permit persons to whom the Software is
mkilivan 0:8e1971a883be 10 furnished to do so, subject to the following conditions:
mkilivan 0:8e1971a883be 11
mkilivan 0:8e1971a883be 12 The above copyright notice and this permission notice shall be included in
mkilivan 0:8e1971a883be 13 all copies or substantial portions of the Software.
mkilivan 0:8e1971a883be 14
mkilivan 0:8e1971a883be 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
mkilivan 0:8e1971a883be 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
mkilivan 0:8e1971a883be 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
mkilivan 0:8e1971a883be 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
mkilivan 0:8e1971a883be 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mkilivan 0:8e1971a883be 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
mkilivan 0:8e1971a883be 21 THE SOFTWARE.
mkilivan 0:8e1971a883be 22 */
mkilivan 0:8e1971a883be 23
mkilivan 0:8e1971a883be 24 #ifndef SIMPLE_HANDLER_H
mkilivan 0:8e1971a883be 25 #define SIMPLE_HANDLER_H
mkilivan 0:8e1971a883be 26
mkilivan 0:8e1971a883be 27 #include "../HTTPRequestHandler.h"
mkilivan 0:8e1971a883be 28
mkilivan 0:8e1971a883be 29 class SimpleHandler : public HTTPRequestHandler
mkilivan 0:8e1971a883be 30 {
mkilivan 0:8e1971a883be 31 public:
mkilivan 0:8e1971a883be 32 SimpleHandler(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection);
mkilivan 0:8e1971a883be 33 virtual ~SimpleHandler();
mkilivan 0:8e1971a883be 34
mkilivan 0:8e1971a883be 35 //protected:
mkilivan 0:8e1971a883be 36 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection) { return new SimpleHandler(rootPath, path, pTCPSocketConnection); } //if we ever could do static virtual functions, this would be one
mkilivan 0:8e1971a883be 37
mkilivan 0:8e1971a883be 38 virtual void doGet();
mkilivan 0:8e1971a883be 39 virtual void doPost();
mkilivan 0:8e1971a883be 40 virtual void doHead();
mkilivan 0:8e1971a883be 41
mkilivan 0:8e1971a883be 42 virtual void onReadable(); //Data has been read
mkilivan 0:8e1971a883be 43 virtual void onWriteable(); //Data has been written & buf is free
mkilivan 0:8e1971a883be 44 virtual void onClose(); //Connection is closing
mkilivan 0:8e1971a883be 45 };
mkilivan 0:8e1971a883be 46
mkilivan 0:8e1971a883be 47 #endif