cgi_application.h

00001 /*
00002  * cgi_application.h
00003  * This file is part of dbPager Classes Library (DCL)
00004  *
00005  * Copyright (c) 2008 Dennis Prochko <wolfsoft@mail.ru>
00006  *
00007  * DCL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation version 3.
00010  *
00011  * DCL is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with DCL; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  * Boston, MA  02110-1301  USA
00020  */
00021 
00022 #ifndef _CGI_APPLICATION_H_
00023 #define _CGI_APPLICATION_H_
00024 
00025 #include <dcl/singleton.h>
00026 #include <dcl/web_application.h>
00027 
00028 namespace dbp {
00029 
00031 
00044 class cgi_application: public web_application_int,
00045   public singleton<cgi_application> {
00046         friend class singleton<cgi_application>;
00047 public:
00048         virtual void on_handle_request(on_request_handler handler) {
00049                 request_handler = handler;
00050         };
00051         virtual void on_exception(on_exception_handler handler) {
00052                 exception_handler = handler;
00053         };
00055         int run(int argc, char *argv[]);
00056 protected:
00057         virtual http_request get_request();
00058         virtual void send_response(const http_response &response);
00059 private:
00060         on_request_handler request_handler;
00061         on_exception_handler exception_handler;
00062 };
00063 
00064 } //namespace
00065 
00066 #endif /*_CGI_APPLICATION_H_*/

 
Support This Project
SourceForge.net Logo