Wt examples
3.3.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
build
buildd
witty-3.3.1
examples
wt-homepage
main.C
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2009 Emweb bvba, Kessel-Lo, Belgium.
3
*
4
* See the LICENSE file for terms of use.
5
*/
6
7
#include <Wt/WServer>
8
#include <Wt/Dbo/SqlConnectionPool>
9
10
#include "BlogRSSFeed.h"
11
#include "model/BlogSession.h"
12
#include "model/Token.h"
13
#include "model/User.h"
14
#include "
WtHome.h
"
15
#include "
JWtHome.h
"
16
17
int
main
(
int
argc,
char
**argv)
18
{
19
try
{
20
WServer
server(argv[0]);
21
22
server.
setServerConfiguration
(argc, argv, WTHTTP_CONFIGURATION);
23
24
BlogSession::configureAuth();
25
26
Wt::Dbo::SqlConnectionPool
*blogDb
27
= BlogSession::createConnectionPool(server.
appRoot
() +
"blog.db"
);
28
29
BlogRSSFeed rssFeed(*blogDb,
"Wt and JWt blog"
,
30
"http://www.webtoolkit.eu/wt/blog"
,
31
"We care about our webtoolkits."
);
32
33
server.
addResource
(&rssFeed,
"/wt/blog/feed/"
);
34
35
server.
addEntryPoint
(
Application
,
36
boost::bind(&
createJWtHomeApplication
, _1, blogDb),
37
"/jwt"
,
"/css/jwt/favicon.ico"
);
38
server.
addEntryPoint
(
Application
,
39
boost::bind(&
createWtHomeApplication
, _1, blogDb),
40
""
,
"/css/wt/favicon.ico"
);
41
42
if
(server.
start
()) {
43
WServer::waitForShutdown();
44
server.
stop
();
45
}
46
47
delete
blogDb;
48
}
catch
(
Wt::WServer::Exception
& e) {
49
std::cerr << e.what() << std::endl;
50
}
catch
(std::exception &e) {
51
std::cerr <<
"exception: "
<< e.what() << std::endl;
52
}
53
}
main
int main(int argc, char **argv)
Definition:
main.C:17
WtHome.h
Wt::WServer::stop
WTCONNECTOR_API void stop()
Wt::Dbo::SqlConnectionPool
Wt::WServer
Wt::WServer::addResource
WT_API void addResource(WResource *resource, const std::string &path)
Wt::WServer::appRoot
WT_API std::string appRoot() const
Wt::Application
createJWtHomeApplication
WApplication * createJWtHomeApplication(const WEnvironment &env, Wt::Dbo::SqlConnectionPool *blogDb)
Definition:
JWtHome.C:157
createWtHomeApplication
WApplication * createWtHomeApplication(const WEnvironment &env, Wt::Dbo::SqlConnectionPool *blogDb)
Definition:
WtHome.C:170
Wt::WServer::setServerConfiguration
WTCONNECTOR_API void setServerConfiguration(int argc, char *argv[], const std::string &serverConfigurationFile=std::string())
Wt::WServer::addEntryPoint
WT_API void addEntryPoint(EntryPointType type, ApplicationCreator callback, const std::string &path=std::string(), const std::string &favicon=std::string())
Wt::WServer::Exception
Wt::WServer::start
WTCONNECTOR_API bool start()
JWtHome.h
Generated on Wed Jun 11 2014 for
the C++ Web Toolkit (Wt)
by
1.8.7