Handle HTTP Post Method

Dependencies:   EthernetNetIf HTTPServer mbed

PostHandler.h

Committer:
nobuki
Date:
2012-12-01
Revision:
0:5ec5448dc8c5

File content as of revision 0:5ec5448dc8c5:

#ifndef POST_HANDLER_H
#define POST_HANDLER_H

#include <HTTPRequestHandler.h>

class PostHandler : public HTTPRequestHandler
{
public:
  PostHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
  virtual ~PostHandler();

  static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new PostHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one

  virtual void doGet();
  virtual void doPost();
  virtual void doHead();
  
  virtual void onReadable(); //Data has been read
  virtual void onWriteable(); //Data has been written & buf is free
  virtual void onClose(); //Connection is closing
  
private:
  void printString( const char* pszString );
  void printHtml();
};

#endif