Re: [Cppcms-users] session.server.settings example
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-04-27 07:59:46
|
First of all take a look on some ready modules in contrib section
contrib/server_side/sessions
The factory function is called from CppCMS as
f(srv.settings().find("session.server.settings")
So in your case the code
base_ = val.get<std::string>("dir", "/tmp/");
BOOSTER_INFO("session_memory_ext") << "base folder '" << base_;
Is not correct as the "val" is a string object i.e. is is STRING "dir:'/session_storage/'"
I would suggets:
1. Try to print to "val" to the stream so you know what you get in the factory.
2. Print the backtrace of the exception you catch so you can see where it comes from
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
P.S.: Sorry for late reply was busy
>________________________________
> From: Christian Gmeiner <chr...@gm...>
>To: cpp...@li...
>Sent: Friday, April 26, 2013 1:22 PM
>Subject: Re: [Cppcms-users] session.server.settings example
>
>
>2013/4/23 Christian Gmeiner <chr...@gm...>:
>> Hi all
>>
>> "session" : {
>> "expire" : "renew",
>> "timeout" : 600,
>> "keep_alive_interval" : 60,
>> "location" : "server",
>> "gc" : 600,
>> "server": {
>> "storage":"external",
>> "shared_object":"/opt/libcppcms_session_memory_ext.so",
>> "settings":"dir:'/session_storage/'"
>> }
>> },
>>
>> session_memory_ext_storage(cppcms::json::value const &val)
>> {
>> base_ = val.get<std::string>("dir", "/tmp/");
>> BOOSTER_INFO("session_memory_ext") << "base folder '" << base_;
>> }
>>
>> How must my config.js look like to get this working?
>>
>
>Soo.. i tried this snipped
>
> cppcms::json::value a;
> cppcms::json::object o;
> o.insert(std::pair<cppcms::string_key,
>cppcms::json::value>("test", "/home/abc"));
> a.object(o);
>
> BOOSTER_DEBUG("a") << "json - " << a.save();
> BOOSTER_DEBUG("a") << a.get<std::string>("test", "/tmp/");
>
>-->
>Apr 26 12:48:58 chgm-pc a: a: json - {"test":"/home/abc"} (main.cpp:227)
>Apr 26 12:48:58 chgm-pc a: a: /home/abc (main.cpp:228)
>
>
>-->
>
> "session" : {
> "expire" : "renew",
> "timeout" : 600,
> "keep_alive_interval" : 60,
> "location" : "server",
> "gc" : 600,
> "server": {
> "storage" : "external",
> "shared_object" :
>"/opt/tssw/libcppcms_session_memory_ext.so",
> "settings" : {
> "dir" : "/home/abc",
> },
> }
> },
>
>-->
>cppcms::json::bad_cast: error converting from object
>
>Any hints?
>
>--
>Christian Gmeiner, MSc
>
>------------------------------------------------------------------------------
>Try New Relic Now & We'll Send You this Cool Shirt
>New Relic is the only SaaS-based application performance monitoring service
>that delivers powerful full stack analytics. Optimize and monitor your
>browser, app, & servers with just a few lines of code. Try New Relic
>and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
>_______________________________________________
>Cppcms-users mailing list
>Cpp...@li...
>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
> |