ffead.server.doc
RequestHandler.h
1 /*
2  Copyright 2009-2012, Sumeet Chhetri
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 /*
17  * RequestHandler.h
18  *
19  * Created on: Aug 17, 2009
20  * Author: sumeet
21  */
22 
23 #ifndef REQUESTHANDLER_H_
24 #define REQUESTHANDLER_H_
25 #include <dlfcn.h>
26 #include "ClassInfo.h"
27 #include "CastUtil.h"
28 #include "View.h"
29 #include "XmlParser.h"
30 #include "TemplateHandler.h"
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <unistd.h>
34 #include <errno.h>
35 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <netinet/in.h>
38 #include <netdb.h>
39 #include <arpa/inet.h>
40 #include <sys/wait.h>
41 #include <signal.h>
42 #include "DynamicView.h"
43 #include "HttpRequest.h"
44 #include <algorithm>
45 #include "PropFileReader.h"
46 #include "AfcUtil.h"
47 #include "ServerThread.h"
48 #include "Thread.h"
49 #include "Mutex.h"
50 
51 #define MAXBUFLEN 1024
52 //extern map<string,HttpSession> sessionMap;
54 public:
55 
56  RequestHandler(int,string,string);
57 
59  {
60  m_stoprequested = true;
61  m_thread.join(); //Note 2
62  }
63  void service(int,string,string);
64 private:
65  volatile bool m_stoprequested;
66  Mutex m_mutex;
67  Thread m_thread;
68 };
69 
70 #endif /* REQUESTHANDLER_H_ */