CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

requesthandler.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Ilya A. Volynets-Evenbakh                       *
00003  *   ilya@total-knowledge.com                                              *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef CSERVIMPLREQUESTHANDLER_H
00021 #define CSERVIMPLREQUESTHANDLER_H
00022 
00023 #include <sptk4/CThread.h>
00024 #include <sptk4/CWaiter.h>
00025 #include <sptk4/CRWLock.h>
00026 #include <map>
00027 #include <requestlistener.h>
00028 #include <connection.h>
00029 #include <servletcontainer.h>
00030 #include <util.h>
00031 #include <sptk4/CThreadPool.h>
00032 #include "ServletMap.h"
00033 
00034 namespace container {
00035 
00036 class RequestDispatcher;
00042 class RequestHandler : public sptk::CThreadPool::Task
00043 {
00044 public:
00045     RequestHandler(Connection* con);
00046     virtual ~RequestHandler();
00047     static bool addServlet(const std::string&,ServletContainer*);
00048     static bool removeServlet(const std::string& name);
00049     virtual void taskFunction();
00050 private:
00051     struct ServDesc
00052     {
00053         sptk::CRWLock m_servletLock;
00054         ServletContainer* m_cont;
00055         ServDesc(ServletContainer* cont):m_cont(cont){}
00056     };
00057     typedef ServletMap<ServDesc> urlmap_t;
00058     static urlmap_t m_urlMap;
00059     static sptk::CRWLock m_servletMapLock;
00060     Connection* m_con;
00061     static std::string m_noSuchServletText;
00062 private:
00063     void noSuchServlet();
00064 protected:
00065 };
00066 
00067 }
00068 
00069 #endif

SourceForge.net Logo