ffead.server.doc
ServiceTask.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  * ServiceTask.h
18  *
19  * Created on: 20-Jun-2012
20  * Author: sumeetc
21  */
22 
23 #ifndef SERVICETASK_H_
24 #define SERVICETASK_H_
25 #include "Task.h"
26 #include "SSLHandler.h"
27 #include "StringUtil.h"
28 #include "ConfigurationHandler.h"
29 #include "FormController.h"
30 #include "RestController.h"
31 #include "SecurityHandler.h"
32 #include "FilterHandler.h"
33 #include "AuthHandler.h"
34 #include "ControllerHandler.h"
35 #include "FormHandler.h"
36 #include "SoapHandler.h"
37 #include "ScriptHandler.h"
38 #include "FviewHandler.h"
39 #include "ExtHandler.h"
40 #include "Logger.h"
41 #define MAXBUFLENM 32768
42 #define BUFSIZZ 1024
43 
44 class ServiceTask : public Task
45 {
46  Logger logger;
47  SecurityHandler securityHandler;
48  FilterHandler filterHandler;
49  AuthHandler authHandler;
50  ControllerHandler controllerHandler;
51  FormHandler formHandler;
52  SoapHandler soapHandler;
53  ScriptHandler scriptHandler;
54  FviewHandler fviewHandler;
55  ExtHandler extHandler;
56  int fd;
57  string serverRootDirectory;
58  map<string,string> *params;
59  bool isSSLEnabled;
60  SSL_CTX *ctx;
61  SSLHandler sslHandler;
62  ConfigurationData configData;
63  void* dlib;
64  void* ddlib;
65  void writeToSharedMemeory(string sessionId, string value,bool napp);
66  map<string,string> readFromSharedMemeory(string sessionId);
67  void createResponse(HttpResponse &res,bool flag,map<string,string> vals,string prevcookid, long sessionTimeout, bool sessatserv);
68  string getContentStr(string url,string locale,string ext);
69 public:
70  ServiceTask(int fd,string serverRootDirectory,map<string,string> *params,
71  bool isSSLEnabled, SSL_CTX *ctx, SSLHandler sslHandler, ConfigurationData configData, void* dlib, void* ddlib);
72  virtual ~ServiceTask();
73  void run();
74  HttpResponse apacheRun(HttpRequest* req);
75  static string getFileExtension(string file);
76 };
77 
78 #endif /* SERVICETASK_H_ */