ffead.server.doc
ControllerHandler.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  * ControllerHandler.h
18  *
19  * Created on: Jun 17, 2012
20  * Author: Sumeet
21  */
22 
23 #ifndef CONTROLLERHANDLER_H_
24 #define CONTROLLERHANDLER_H_
25 #include "Controller.h"
26 #include "RestController.h"
27 #include "AuthHandler.h"
28 #include "Constants.h"
29 #include "Logger.h"
30 #include "XMLSerialize.h"
31 #include "JSONSerialize.h"
32 
33 typedef void* (*toObjectFromJson) (string);
34 
36 {
37 public:
38  string name;
39  string type;
40  string from;
41 };
42 
44 {
45 public:
46  string name;
47  string alias;
48  string clas;
49  string meth;
50  string baseUrl;
51  string icontentType;
52  string ocontentType;
53  vector<RestFunctionParams> params;
54 };
55 
56 typedef map<string, RestFunction> resFuncMap;
57 
59 public:
61  virtual ~ControllerHandler();
62  static bool handle(HttpRequest* req, HttpResponse& res, map<string, string> urlpattMap, map<string, string> mappattMap, void* dlib,
63  string ext, resFuncMap rstCntMap, map<string, string> mapMap, map<string, string> urlMap, string pthwofile);
64 };
65 
66 #endif /* CONTROLLERHANDLER_H_ */