and tntnet too ?
then try this:
// Instantiate an application object
tnt::Tntnet app;
// Create a configuration object
tnt::TntConfig config;
// Alternatively, the static instance can be used:
// tnt::TntConfig& config = tnt::TntConfig::it();
// Open the configfile
std::ifstream tntnetXml("tntnet.xml");
// Deserialize the content of tntnetXml and save it to config
tntnetXml >> cxxtools::Xml(config);
// Pass the configuration to the application object
app.init(config);
2014-08-26 16:31 GMT+02:00 Jean-Marc Choulet <[email protected]>:
> Yes.
>
> Le 26/08/2014 16:30, Ralf Schülke a écrit :
>>
>> this is the github source code version?
>>
>> 2014-08-26 16:25 GMT+02:00 Jean-Marc Choulet <[email protected]>:
>>>
>>> # cxxtools-config --version
>>> 2.2rc4
>>>
>>> Le 26/08/2014 16:15, Ralf Schülke a écrit :
>>>>
>>>> ok, you don't need separately set your UrlMap in the main().
>>>> I think the problem is your read and deserialize the tntnet.xml config
>>>> file.
>>>> what version you are used from cxxtools and tntnet?
>>>> have you read this (scroll down) ->
>>>> http://www.tntnet.org/apidoc/html/structtnt_1_1_tnt_config.html
>>>>
>>>> 2014-08-26 16:02 GMT+02:00 Jean-Michel Caricand
>>>> <[email protected]>:
>>>>>
>>>>> I used this guide. My tntnet.xml content :
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!--
>>>>> This is the main configuration file for tntnet.
>>>>>
>>>>> You can find documentation about the parameters in the man page
>>>>> tntnet.xml(7)
>>>>> -->
>>>>> <tntnet>
>>>>> <mappings>
>>>>> <!-- map / to MyApp@MyApp -->
>>>>> <mapping>
>>>>> <target>MyApp@MyApp</target>
>>>>> <url>^/$</url>
>>>>> </mapping>
>>>>> <!-- map /comp.* or /comp to comp@MyApp -->
>>>>> <mapping>
>>>>> <target>$1@MyApp</target>
>>>>> <url>^/([^.]+)(\..+)?</url>
>>>>> </mapping>
>>>>> </mappings>
>>>>>
>>>>> <!-- listen to a port (empty string means any local interface) -->
>>>>> <listeners>
>>>>> <listener>
>>>>> <port>8000</port>
>>>>> </listener>
>>>>> <!-- a certificate enables ssl -->
>>>>> <!--
>>>>> <listener>
>>>>> <port>8443</port>
>>>>> <certificate>tntnet.pem</certificate>
>>>>> </listener>
>>>>> -->
>>>>> </listeners>
>>>>>
>>>>> <logging>
>>>>> <rootlogger>INFO</rootlogger>
>>>>>
>>>>> <loggers>
>>>>> <logger>
>>>>> <category>tntnet</category>
>>>>> <level>INFO</level>
>>>>> </logger>
>>>>> <logger>
>>>>> <category>component.MyApp</category>
>>>>> <level>INFO</level>
>>>>> </logger>
>>>>> </loggers>
>>>>>
>>>>> <!--
>>>>> <file>tntnet.log</file>
>>>>> <maxfilesize>10M</maxfilesize>
>>>>> <maxbackupindex>2</maxbackupindex>
>>>>> -->
>>>>>
>>>>> </logging>
>>>>>
>>>>> <!-- <maxRequestSize>65536</maxRequestSize> -->
>>>>> <!-- <maxRequestTime>600</maxRequestTime> -->
>>>>> <!-- <user>tntnet</user> -->
>>>>> <!-- <group>tntnet</group> -->
>>>>> <!-- <dir>/</dir> -->
>>>>> <!-- <chrootdir>/var/safedir</chrootdir> -->
>>>>> <!-- <pidfile>/var/run/tntnet.pid</pidfile> -->
>>>>> <!-- <daemon>0</daemon> -->
>>>>> <!-- <minThreads>5</minThreads> -->
>>>>> <!-- <maxThreads>100</maxThreads> -->
>>>>> <!-- <threadStartDelay>10</threadStartDelay> -->
>>>>> <!-- <queueSize>1000</queueSize> -->
>>>>> <!--
>>>>> <compPath>
>>>>> <entry>path1</entry>
>>>>> <entry>path2</entry>
>>>>> </compPath>
>>>>> -->
>>>>> <!-- <socketBufferSize>16384</socketBufferSize> -->
>>>>> <!-- <socketReadTimeout>10</socketReadTimeout> -->
>>>>> <!-- <socketWriteTimeout>10000</socketWriteTimeout> -->
>>>>> <!-- <keepAliveTimeout>15000</keepAliveTimeout> -->
>>>>> <!-- <keepAliveMax>1000</keepAliveMax> -->
>>>>> <!-- <sessionTimeout>300</sessionTimeout> -->
>>>>> <!-- <listenBacklog>64</listenBacklog> -->
>>>>> <!-- <listenRetry>5</listenRetry> -->
>>>>> <!-- <enableCompression>no</enableCompression> -->
>>>>> <!-- <mimeDb>/etc/mime.types</mimeDb> -->
>>>>> <!-- <minCompressSize>1024</minCompressSize> -->
>>>>> <!-- <maxUrlMapCache>8192</maxUrlMapCache> -->
>>>>> <!-- <defaultContentType>text/html;
>>>>> charset=UTF-8</defaultContentType> -->
>>>>> <!-- <accessLog>/var/log/tntnet/access.log</accessLog> -->
>>>>> <!-- <errorLog>/var/log/tntnet/error.log</errorLog> -->
>>>>> <!-- <maxBackgroundTasks>5</maxBackgroundTasks> -->
>>>>> <!-- <server>Tntnet</server> -->
>>>>>
>>>>> <myvar>TEST</myvar>
>>>>> </tntnet>
>>>>> ...
>>>>>
>>>>>
>>>>> If I remove :
>>>>> app.mapUrl("^/$", "MyApp");
>>>>> app.mapUrl("^/([^.]+)(\\..+)?", "$1");
>>>>>
>>>>> I can't see my page. All works fine if I build a library.
>>>>>
>>>>> Jean-Michel
>>>>>
>>>>> Le 26/08/2014 15:38, Ralf Schülke a écrit :
>>>>>>
>>>>>> Ok, look into your tntnet.xml,
>>>>>> what are is set to UrlMap?
>>>>>>
>>>>>> You found on the homepage a start guid he see you a samll code for a
>>>>>> standalone application.
>>>>>>
>>>>>> Creating a standalone web application ->
>>>>>> http://www.tntnet.org/quick-start-guide.html
>>>>>>
>>>>>> 2014-08-26 15:24 GMT+02:00 Jean-Michel Caricand
>>>>>> <[email protected]>:
>>>>>>>
>>>>>>> That works with :
>>>>>>>
>>>>>>> #include <tnt/tntnet.h>
>>>>>>> #include <cxxtools/log.h>
>>>>>>> #include <cxxtools/xml/xmldeserializer.h>
>>>>>>>
>>>>>>> log_define("main");
>>>>>>>
>>>>>>> int main(int argc, char* argv[])
>>>>>>> {
>>>>>>> try {
>>>>>>> log_init();
>>>>>>>
>>>>>>> tnt::Tntnet app;
>>>>>>> tnt::TntConfig config;
>>>>>>>
>>>>>>> std::ifstream conf("tntnet.xml");
>>>>>>>
>>>>>>> app.mapUrl("^/$", "MyApp");
>>>>>>> app.mapUrl("^/([^.]+)(\\..+)?", "$1");
>>>>>>>
>>>>>>> cxxtools::xml::XmlDeserializer deserializer(conf);
>>>>>>> deserializer.deserialize(config);
>>>>>>>
>>>>>>> app.init(config);
>>>>>>>
>>>>>>> app.run();
>>>>>>> }
>>>>>>> catch (const std::exception& e) {
>>>>>>> std::cerr << e.what() << std::endl;
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Le 26/08/2014 14:19, Jouven a écrit :
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm assuming you have used the "tntnet-config --project MyApp" as a
>>>>>>>> "template" to create your standalone application version of it. I
>>>>>>>> think the problem is that you missed to add the component part, the
>>>>>>>> ecpp file, you can just "ecppc" the MyApp.ecpp to get a MyApp.cpp
>>>>>>>> and
>>>>>>>> add it to your project.
>>>>>>>>
>>>>>>>> Joan Escalas
>>>>>>>> On 26/08/2014 13:44, Jean-Michel Caricand wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I created a standalone application :
>>>>>>>>>
>>>>>>>>> tntnet-config --project MyApp
>>>>>>>>>
>>>>>>>>> In my main.cpp, I have :
>>>>>>>>>
>>>>>>>>> #include <tnt/tntnet.h>
>>>>>>>>> #include <cxxtools/log.h>
>>>>>>>>> #include <cxxtools/xml/xmldeserializer.h>
>>>>>>>>>
>>>>>>>>> log_define("main");
>>>>>>>>>
>>>>>>>>> int main(int argc, char* argv[])
>>>>>>>>> {
>>>>>>>>> try {
>>>>>>>>> log_init();
>>>>>>>>>
>>>>>>>>> tnt::Tntnet app;
>>>>>>>>> tnt::TntConfig config;
>>>>>>>>>
>>>>>>>>> std::ifstream conf("tntnet.xml");
>>>>>>>>>
>>>>>>>>> cxxtools::xml::XmlDeserializer deserializer(conf);
>>>>>>>>> deserializer.deserialize(config);
>>>>>>>>>
>>>>>>>>> app.init(config);
>>>>>>>>>
>>>>>>>>> app.run();
>>>>>>>>> }
>>>>>>>>> catch (const std::exception& e) {
>>>>>>>>> std::cerr << e.what() << std::endl;
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> I run my app :
>>>>>>>>>
>>>>>>>>> ./myapp
>>>>>>>>>
>>>>>>>>> When I try to access to my app, I get this error :
>>>>>>>>>
>>>>>>>>> Error
>>>>>>>>>
>>>>>>>>> Not Found: vhost: localhost:8000 /
>>>>>>>>>
>>>>>>>>> Any idea ?
>>>>>>>>>
>>>>>>>>> Thank,
>>>>>>>>>
>>>>>>>>> Jean-Marc
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> Slashdot TV.
>>>>>>>>> Video for Nerds. Stuff that matters.
>>>>>>>>> http://tv.slashdot.org/
>>>>>>>>> _______________________________________________
>>>>>>>>> Tntnet-general mailing list
>>>>>>>>> [email protected]
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Slashdot TV.
>>>>>>> Video for Nerds. Stuff that matters.
>>>>>>> http://tv.slashdot.org/
>>>>>>> _______________________________________________
>>>>>>> Tntnet-general mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Slashdot TV.
>>>>>> Video for Nerds. Stuff that matters.
>>>>>> http://tv.slashdot.org/
>>>>>> _______________________________________________
>>>>>> Tntnet-general mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Slashdot TV.
>>>>> Video for Nerds. Stuff that matters.
>>>>> http://tv.slashdot.org/
>>>>> _______________________________________________
>>>>> Tntnet-general mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Slashdot TV.
>>>> Video for Nerds. Stuff that matters.
>>>> http://tv.slashdot.org/
>>>> _______________________________________________
>>>> Tntnet-general mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Slashdot TV.
>>> Video for Nerds. Stuff that matters.
>>> http://tv.slashdot.org/
>>> _______________________________________________
>>> Tntnet-general mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general