Menu

[r858]: / framework / trunk / application.cpp  Maximize  Restore  History

Download this file

49 lines (43 with data), 896 Bytes

 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
37
38
39
40
41
42
43
44
45
46
47
48
#include "application.h"
namespace cppcms {
application::application(worker_thread &w) :
worker(w),
url(w.url),
app(worker.app),
cgi(worker.cgi),
env(worker.env),
cgi_conn(worker.cgi_conn),
cache(worker.cache),
session(worker.session),
cout(worker.cout),
on_start(worker.on_start),
on_end(worker.on_end)
{
}
application::~application()
{
}
void application::on_404()
{
add_header("Content-Type: text/html");
set_header(new cgicc::HTTPStatusHeader(404,"Not found"));
cout<< "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
"<html>\n"
" <head>\n"
" <title>404 - Not Found</title>\n"
" </head>\n"
" <body>\n"
" <h1>404 - Not Found</h1>\n"
" </body>\n"
"</html>\n";
}
void application::main()
{
on_start();
if(url.parse()<0) {
on_404();
}
on_end();
}
}
MongoDB Logo MongoDB