-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleClass.cpp
More file actions
36 lines (27 loc) · 1.01 KB
/
SimpleClass.cpp
File metadata and controls
36 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <fastcgi2/component.h>
#include <fastcgi2/component_factory.h>
#include <fastcgi2/handler.h>
#include <fastcgi2/request.h>
#include <iostream>
class SimpleClass : virtual public fastcgi::Component, virtual public fastcgi::Handler {
public:
SimpleClass(fastcgi::ComponentContext *context) :
fastcgi::Component(context) {
}
virtual ~SimpleClass() {
}
public:
virtual void onLoad() {
}
virtual void onUnload() {
}
virtual void handleRequest(fastcgi::Request *request, fastcgi::HandlerContext *context) {
//«десь размещаетс¤ код обработки запроса
request->setHeader("Simple-Header", "Reply from csimple");
const char* response_body="Hello world!\n";
request->write(response_body,strlen(response_body));
}
};
FCGIDAEMON_REGISTER_FACTORIES_BEGIN()
FCGIDAEMON_ADD_DEFAULT_FACTORY("simple_factory", SimpleClass)
FCGIDAEMON_REGISTER_FACTORIES_END()