cppcms-users Mailing List for CppCMS C++ Web Framework (Page 20)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: eric m. <mid...@gm...> - 2016-02-21 18:36:01
|
Hello, I have been wrestling with a cppcms-problem all day and find myself out of options. Relevant sources are included. I'm controlling a robot via a web-interface and always have a single user. The robot reports status to the browser via SSE which is working fine. The robot-thread reports status-strings via boost/signal2 to the StatusStreamServer which sents events to a webpage where I can see them. There is another stream I use when a new usb-device is discovered or lost (via the udev library). That also results in a boost-signal but now to the DeviceManagementStreamServer. This results in a modal popup in the browser. If the popup is closed by the user, the page is reloaded via location.reload(true) to accommodate for the new or removed usbdevice (menu is changed with new or removed options). And that repeats the last SSE-event for some reason, which results in the same popup again. I want is to be able to clear SSE events that have been sent but can't figure out how to do that. Who knows how to do this? Furthermore I notice that connections are lost about every 30 seconds, which seems to be some regulated timeout. Where is that configured? The other thing I notice is that sometimes SSE events are sent without content and without me initiating them. Where do these come from? Any help is welcome. Both StreamServers are created like this: // Device Management Stream booster::intrusive_ptr<StreamServer> deviceManagementStreamServer = new DeviceManagementStreamServer(service, "DeviceManagementStreamServer"); deviceManagementStreamServer->connectSlot(); service.applications_pool().mount(deviceManagementStreamServer, cppcms::mount_point("/device_management_stream")); // Status Stream booster::intrusive_ptr<StreamServer> statusStreamServer = new StatusStreamServer(service, "StatusStreamServer"); statusStreamServer->connectSlot(); service.applications_pool().mount(statusStreamServer, cppcms::mount_point("/status_stream")); Kind regards, Eric |
From: eric m. <mid...@gm...> - 2016-02-21 09:12:53
|
Hi Artyom, Thanks for clarifying. To answer your question: I have a thread that controls a motor and another thread that services a webinterface. I send a command from the webthread to the motorthread via an ajax-call and that has to be asynchronous otherwise it will not respond to input from the user. Meanwhile the motorthread starts doing its thing and that can take a while but it has to report back status to the user. I now use two asynchronous ajax-calls: one for receiving the status from the motorthread that waits for it and another one to send the command to the motorthread that returns immediately. When I asked the question my intention was to report back with using the second ajax-call for receiving the status from the motorthread. There's another thing I'm wondering about. Given the ticker_example: is it possible to have two independent streams under the same endpoint, say /ticker/stream1 and /ticker/stream2 and if yes how would I do that? Kind regards, Eric On Tue, Feb 16, 2016 at 2:02 AM, Artyom Beilis <art...@gm...> wrote: > > Taking the json_rpc_chat example as a starting point, is it possible to > > respond to get() from another thread? Let me elaborate a bit on that. > > > > In the chat example the get activates a callback that is called by a post > > from the browser via the broadcast method. Is it possible to let this > > callback be called by a different server-thread that is performing a task > > and comes back with the result to be returned to the original get > activated > > by the browser? > > > > To put it differently, is it possible to interact with the > json_rpc_server > > and fullfill callbacks from outside? > > > > Reason for asking is that I'm using ajax-calls to perform tasks on the > > server but I do not want the browser to hang up on it while waiting for > the > > result. > > > > Kind regards, > > Eric > > > > > To be honest I don't clearly understand what are you trying to do. > > You have two types of applications: > > 1. Synchronous - running in threads and returning result immediately > 2. Asynchronous - running in a single event loop - that can postpone > the response or keep long running open connections if needed. > > You can "send" messages from synchronous apps (or what ever thread) > to asynchronous apps by posting callbacks to the main > event loop - i.e. service().post(some_function) such that this > "some_function" would be executed in the event loop and can interact > with the async apps. > > So for example you can have a generic thread that posts every minute a > message to the chat from some thread > using this callback method. > > > Artyom > > > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |
From: Rodrigo E. <rod...@gm...> - 2016-02-16 13:03:53
|
Hi Artyom, Thanks again, this solution works much better and more straightforward . 2016-02-16 10:29 GMT-02:00 Artyom Beilis <art...@gm...>: > Wouldn't instead of > > { "regex" : "/()" , "pattern" : "/mb.fcgi/index" }, > dispatcher().assign("/index",&site::index,this); > > The following would work out of the box > > dispatcher().assign("/",&site::index,this); > > i.e. without this specific pattern. > > On Mon, Feb 15, 2016 at 7:19 PM, Rodrigo Emygdio > <rod...@gm...> wrote: > > Hi Everyone, > > > > First of all, I would like to thanks the fast feedback of Stanimir and > good > > explanation that Artyom Beilis did. I am glad to say that this thread was > > resolved. > > With base on the Artyom's explanation I understood how the routing of > urls > > works. > > I resolved my problem in this way: > > First, I created index route that is the main page: > > > > dispatcher().assign("/index",&site::index,this); > > mapper().assign("index","/index"); > > > > And all the other url I created in the same form: > > > > dispatcher().assign("/contact-form",&site::contact_form,this); > > mapper().assign("contact_form","/contact-form"); > > > > dispatcher().assign("/do-something,&site::something,this); > > mapper().assign("something","/do-something"); > > > > > > To accomplish my objective, I used two regex for the rewrite url rules, > like > > that: > > > > { "regex" : "/()" , "pattern" : "/mb.fcgi/index" }, > > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > > > > The first one, does the route for url with "/" and empty urls > > (http://domain.com/ and http://domain.com). And the second executes the > rest > > of the urls (http://domain.com/contact-form and > > http://domain.com/do-something). > > > > I hope this thread may help another person with the same doubt > > > > Best Regard > > > > 2016-02-12 15:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > >> > >> Hi Everyone, > >> > >> I decided to give up CppCMS-Embedded and fight with the lighttpd. I > >> configured the lighttpd to execute the application in the "root" of the > web > >> service with the following configuration: > >> > >> server.port = 8080 > >> server.bind = "127.0.0.1" > >> > >> fastcgi.server = ( "/" => ( "localhost" => ( > >> "bin-path" => > >> > "/home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/hello -c > >> > /home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/etc/config-lighthttpd-2.js", > >> "socket" => "/tmp/hello-fcgi-socket", > >> "fix-root-scriptname" => "enable", > >> "check-local" => "disable", > >> ))) > >> > >> The pretty urls work very well, like http://domain.com/some-pretty-url. > >> But the empty router like this http://domain.com/, still doesn't work. > >> > >> Any assist will be very welcome > >> > >> Thanks > >> > >> > >> 2016-02-12 2:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > >>> > >>> I think that I need to explain better what I would like expect from the > >>> CppCms. I have a little application that I wrote in Java and have > specific > >>> urls indexed by google: > >>> http://domain.com/ --> reflects the main page > >>> http://domain.com/[others-pretty-url] --> reflects each functions > of > >>> the application. > >>> The application urls were indexed by google, and I don't want to lose > >>> these urls. I need to rewrite this application in C++ and I decided to > use > >>> CppCms. Then I expect to use the same URLs as were indexed by Google. > The > >>> main page need to responds the root url (http://domain.com/) and the > other > >>> urls need respond like pretty urls (http://domain.com/some-pretty-url > ). > >>> > >>> I did as Artyom tells me to do. Changing the rewrite rules as below: > >>> > >>> change: > >>> > >>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > >>> > >>> for this: > >>> > >>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1"} > >>> > >>> Immediately resolved the problem with the root url, but the rest of > urls > >>> stop to work because the server takes the part after the "/" and > >>> concatenates with the /mb.fcgi. Unhappily there isn't any url with no > "/" > >>> before them. > >>> I tried overcome that changing the dispatcher configuration of the > url, > >>> like that: > >>> > >>> I changed this: > >>> dispatcher().assign("/contact-form",&my_app::contact_form,this); > >>> mapper().assign("contact_form","/contact-form"); > >>> > >>> For this: > >>> dispatcher().assign("contact-form",&my_app::contact_form,this); > >>> mapper().assign("contact_form","contact-form"); > >>> > >>> Unhappily this changing didn't work. > >>> > >>> Anybody has some idea how I can resolve that. > >>> Thanks > >>> > >>> 2016-02-11 20:56 GMT-02:00 Rodrigo Emygdio <rod...@gm... > >: > >>>> > >>>> Hi Artyom, > >>>> > >>>> Thanks very much for your feedback. I tested the virtual main method > and > >>>> is executing properly. I changed the regex and the root url works > very well. > >>>> The problem now is that any other url just works if I add an extra > "/" on > >>>> the begin on the path. > >>>> > >>>> Thanks > >>>> > >>>> 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: > >>>>> > >>>>> > class my_app : public cppcms::application{ > >>>>> > public: > >>>>> > my_app(cppcms::service& s) : cppcms::application(s){ > >>>>> > dispatcher().assign("",&my_app::well_come,this); > >>>>> > mapper().assign(""); > >>>>> > mapper().root(""); > >>>>> > } > >>>>> > >>>>> 1st check if cppcms::application::main is called (I think it should) > >>>>> it is virtual > >>>>> member function so you can override it. > >>>>> > >>>>> 2nd When you access to "localhost:8080" you get request GET / > HTTP/1.0 > >>>>> it is mapped according to the rules to > >>>>> > >>>>> /mb.fcgi/ > >>>>> > >>>>> Than /mb.fcgi is matched and the path you get is "/" > >>>>> > >>>>> When you map to "" you Require empty path and thus it does not get > >>>>> dispatched. > >>>>> > >>>>> The correct is always to map to something starting with "/" or map to > >>>>> "/?" i.e. last "/" is optional. > >>>>> > >>>>> > >>>>> You can also use little bit different rule > >>>>> > >>>>> Instead of this > >>>>> > >>>>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > >>>>> > >>>>> Use > >>>>> > >>>>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } > >>>>> > >>>>> Than none of your urls will start from "/" > >>>>> > >>>>> it does not matter how do you do it - just pic and convention and > stick > >>>>> to it. > >>>>> > >>>>> Artyom > >>>>> > >>>>> > >>>>> > ------------------------------------------------------------------------------ > >>>>> Site24x7 APM Insight: Get Deep Visibility into Application > Performance > >>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > >>>>> Monitor end-to-end web transactions and take corrective actions now > >>>>> Troubleshoot faster and improve end-user experience. Signup Now! > >>>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > >>>>> _______________________________________________ > >>>>> Cppcms-users mailing list > >>>>> Cpp...@li... > >>>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users > >>>> > >>>> > >>> > >> > > > > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@gm...> - 2016-02-16 12:29:29
|
Wouldn't instead of { "regex" : "/()" , "pattern" : "/mb.fcgi/index" }, dispatcher().assign("/index",&site::index,this); The following would work out of the box dispatcher().assign("/",&site::index,this); i.e. without this specific pattern. On Mon, Feb 15, 2016 at 7:19 PM, Rodrigo Emygdio <rod...@gm...> wrote: > Hi Everyone, > > First of all, I would like to thanks the fast feedback of Stanimir and good > explanation that Artyom Beilis did. I am glad to say that this thread was > resolved. > With base on the Artyom's explanation I understood how the routing of urls > works. > I resolved my problem in this way: > First, I created index route that is the main page: > > dispatcher().assign("/index",&site::index,this); > mapper().assign("index","/index"); > > And all the other url I created in the same form: > > dispatcher().assign("/contact-form",&site::contact_form,this); > mapper().assign("contact_form","/contact-form"); > > dispatcher().assign("/do-something,&site::something,this); > mapper().assign("something","/do-something"); > > > To accomplish my objective, I used two regex for the rewrite url rules, like > that: > > { "regex" : "/()" , "pattern" : "/mb.fcgi/index" }, > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > > The first one, does the route for url with "/" and empty urls > (http://domain.com/ and http://domain.com). And the second executes the rest > of the urls (http://domain.com/contact-form and > http://domain.com/do-something). > > I hope this thread may help another person with the same doubt > > Best Regard > > 2016-02-12 15:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: >> >> Hi Everyone, >> >> I decided to give up CppCMS-Embedded and fight with the lighttpd. I >> configured the lighttpd to execute the application in the "root" of the web >> service with the following configuration: >> >> server.port = 8080 >> server.bind = "127.0.0.1" >> >> fastcgi.server = ( "/" => ( "localhost" => ( >> "bin-path" => >> "/home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/hello -c >> /home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/etc/config-lighthttpd-2.js", >> "socket" => "/tmp/hello-fcgi-socket", >> "fix-root-scriptname" => "enable", >> "check-local" => "disable", >> ))) >> >> The pretty urls work very well, like http://domain.com/some-pretty-url. >> But the empty router like this http://domain.com/, still doesn't work. >> >> Any assist will be very welcome >> >> Thanks >> >> >> 2016-02-12 2:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: >>> >>> I think that I need to explain better what I would like expect from the >>> CppCms. I have a little application that I wrote in Java and have specific >>> urls indexed by google: >>> http://domain.com/ --> reflects the main page >>> http://domain.com/[others-pretty-url] --> reflects each functions of >>> the application. >>> The application urls were indexed by google, and I don't want to lose >>> these urls. I need to rewrite this application in C++ and I decided to use >>> CppCms. Then I expect to use the same URLs as were indexed by Google. The >>> main page need to responds the root url (http://domain.com/) and the other >>> urls need respond like pretty urls (http://domain.com/some-pretty-url). >>> >>> I did as Artyom tells me to do. Changing the rewrite rules as below: >>> >>> change: >>> >>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >>> >>> for this: >>> >>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1"} >>> >>> Immediately resolved the problem with the root url, but the rest of urls >>> stop to work because the server takes the part after the "/" and >>> concatenates with the /mb.fcgi. Unhappily there isn't any url with no "/" >>> before them. >>> I tried overcome that changing the dispatcher configuration of the url, >>> like that: >>> >>> I changed this: >>> dispatcher().assign("/contact-form",&my_app::contact_form,this); >>> mapper().assign("contact_form","/contact-form"); >>> >>> For this: >>> dispatcher().assign("contact-form",&my_app::contact_form,this); >>> mapper().assign("contact_form","contact-form"); >>> >>> Unhappily this changing didn't work. >>> >>> Anybody has some idea how I can resolve that. >>> Thanks >>> >>> 2016-02-11 20:56 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: >>>> >>>> Hi Artyom, >>>> >>>> Thanks very much for your feedback. I tested the virtual main method and >>>> is executing properly. I changed the regex and the root url works very well. >>>> The problem now is that any other url just works if I add an extra "/" on >>>> the begin on the path. >>>> >>>> Thanks >>>> >>>> 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: >>>>> >>>>> > class my_app : public cppcms::application{ >>>>> > public: >>>>> > my_app(cppcms::service& s) : cppcms::application(s){ >>>>> > dispatcher().assign("",&my_app::well_come,this); >>>>> > mapper().assign(""); >>>>> > mapper().root(""); >>>>> > } >>>>> >>>>> 1st check if cppcms::application::main is called (I think it should) >>>>> it is virtual >>>>> member function so you can override it. >>>>> >>>>> 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 >>>>> it is mapped according to the rules to >>>>> >>>>> /mb.fcgi/ >>>>> >>>>> Than /mb.fcgi is matched and the path you get is "/" >>>>> >>>>> When you map to "" you Require empty path and thus it does not get >>>>> dispatched. >>>>> >>>>> The correct is always to map to something starting with "/" or map to >>>>> "/?" i.e. last "/" is optional. >>>>> >>>>> >>>>> You can also use little bit different rule >>>>> >>>>> Instead of this >>>>> >>>>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >>>>> >>>>> Use >>>>> >>>>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } >>>>> >>>>> Than none of your urls will start from "/" >>>>> >>>>> it does not matter how do you do it - just pic and convention and stick >>>>> to it. >>>>> >>>>> Artyom >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>>>> Monitor end-to-end web transactions and take corrective actions now >>>>> Troubleshoot faster and improve end-user experience. Signup Now! >>>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >>>>> _______________________________________________ >>>>> Cppcms-users mailing list >>>>> Cpp...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>> >> > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@gm...> - 2016-02-16 07:02:33
|
> Taking the json_rpc_chat example as a starting point, is it possible to > respond to get() from another thread? Let me elaborate a bit on that. > > In the chat example the get activates a callback that is called by a post > from the browser via the broadcast method. Is it possible to let this > callback be called by a different server-thread that is performing a task > and comes back with the result to be returned to the original get activated > by the browser? > > To put it differently, is it possible to interact with the json_rpc_server > and fullfill callbacks from outside? > > Reason for asking is that I'm using ajax-calls to perform tasks on the > server but I do not want the browser to hang up on it while waiting for the > result. > > Kind regards, > Eric > To be honest I don't clearly understand what are you trying to do. You have two types of applications: 1. Synchronous - running in threads and returning result immediately 2. Asynchronous - running in a single event loop - that can postpone the response or keep long running open connections if needed. You can "send" messages from synchronous apps (or what ever thread) to asynchronous apps by posting callbacks to the main event loop - i.e. service().post(some_function) such that this "some_function" would be executed in the event loop and can interact with the async apps. So for example you can have a generic thread that posts every minute a message to the chat from some thread using this callback method. Artyom > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Rodrigo E. <rod...@gm...> - 2016-02-15 17:19:50
|
Hi Everyone, First of all, I would like to thanks the fast feedback of Stanimir and good explanation that Artyom Beilis did. I am glad to say that this *thread was resolved*. With base on the Artyom's explanation I understood how the routing of urls works. I resolved my problem in this way: First, I created index route that is the main page: dispatcher().assign("/index",&site::index,this); mapper().assign("index","/index"); And all the other url I created in the same form: dispatcher().assign("/contact-form",&site::contact_form,this); mapper().assign("contact_form","/contact-form"); dispatcher().assign("/do-something,&site::something,this); mapper().assign("something","/do-something"); To accomplish my objective, I used two regex for the rewrite url rules, like that: { "regex" : "/()" , "pattern" : "/mb.fcgi/index" }, { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } The first one, does the route for url with "/" and empty urls ( http://domain.com/ and http://domain.com). And the second executes the rest of the urls (http://domain.com/contact-form and http://domain.com/do-something). I hope this thread may help another person with the same doubt Best Regard 2016-02-12 15:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > Hi Everyone, > > I decided to give up CppCMS-Embedded and fight with the lighttpd. I > configured the lighttpd to execute the application in the "root" of the web > service with the following configuration: > > server.port = 8080 > server.bind = "127.0.0.1" > > fastcgi.server = ( "/" => ( "localhost" => ( > "bin-path" => > "/home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/hello > -c > /home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/etc/config-lighthttpd-2.js", > "socket" => "/tmp/hello-fcgi-socket", > "fix-root-scriptname" => "enable", > "check-local" => "disable", > ))) > > The pretty urls work very well, like http://domain.com/some-pretty-url. > But the empty router like this http://domain.com/, still doesn't work. > > Any assist will be very welcome > > Thanks > > > 2016-02-12 2:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > >> I think that I need to explain better what I would like expect from the >> CppCms. I have a little application that I wrote in Java and have specific >> urls indexed by google: >> http://domain.com/ --> reflects the main page >> http://domain.com/[others-pretty-url] --> reflects each functions of >> the application. >> The application urls were indexed by google, and I don't want to lose >> these urls. I need to rewrite this application in C++ and I decided to use >> CppCms. Then I expect to use the same URLs as were indexed by Google. The >> main page need to responds the root url (http://domain.com/) and the >> other urls need respond like pretty urls ( >> http://domain.com/some-pretty-url). >> >> I did as Artyom tells me to do. Changing the rewrite rules as below: >> >> change: >> >> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >> >> for this: >> >> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1"} >> >> Immediately resolved the problem with the root url, but the rest of urls >> stop to work because the server takes the part after the "/" and >> concatenates with the /mb.fcgi. Unhappily there isn't any url with no "/" >> before them. >> I tried overcome that changing the dispatcher configuration of the url, >> like that: >> >> I changed this: >> dispatcher().assign("/contact-form",&my_app::contact_form,this); >> mapper().assign("contact_form","/contact-form"); >> >> For this: >> dispatcher().assign("contact-form",&my_app::contact_form,this); >> mapper().assign("contact_form","contact-form"); >> >> Unhappily this changing didn't work. >> >> Anybody has some idea how I can resolve that. >> Thanks >> >> 2016-02-11 20:56 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: >> >>> Hi Artyom, >>> >>> Thanks very much for your feedback. I tested the virtual main method and >>> is executing properly. I changed the regex and the root url works very >>> well. The problem now is that any other url just works if I add an extra >>> "/" on the begin on the path. >>> >>> Thanks >>> >>> 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: >>> >>>> > class my_app : public cppcms::application{ >>>> > public: >>>> > my_app(cppcms::service& s) : cppcms::application(s){ >>>> > dispatcher().assign("",&my_app::well_come,this); >>>> > mapper().assign(""); >>>> > mapper().root(""); >>>> > } >>>> >>>> 1st check if cppcms::application::main is called (I think it should) >>>> it is virtual >>>> member function so you can override it. >>>> >>>> 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 >>>> it is mapped according to the rules to >>>> >>>> /mb.fcgi/ >>>> >>>> Than /mb.fcgi is matched and the path you get is "/" >>>> >>>> When you map to "" you Require empty path and thus it does not get >>>> dispatched. >>>> >>>> The correct is always to map to something starting with "/" or map to >>>> "/?" i.e. last "/" is optional. >>>> >>>> >>>> You can also use little bit different rule >>>> >>>> Instead of this >>>> >>>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >>>> >>>> Use >>>> >>>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } >>>> >>>> Than none of your urls will start from "/" >>>> >>>> it does not matter how do you do it - just pic and convention and stick >>>> to it. >>>> >>>> Artyom >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>>> Monitor end-to-end web transactions and take corrective actions now >>>> Troubleshoot faster and improve end-user experience. Signup Now! >>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >>>> _______________________________________________ >>>> Cppcms-users mailing list >>>> Cpp...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>> >>> >> > |
From: eric m. <mid...@gm...> - 2016-02-14 07:39:01
|
Hi, Taking the json_rpc_chat example as a starting point, is it possible to respond to get() from another thread? Let me elaborate a bit on that. In the chat example the get activates a callback that is called by a post from the browser via the broadcast method. Is it possible to let this callback be called by a different server-thread that is performing a task and comes back with the result to be returned to the original get activated by the browser? To put it differently, is it possible to interact with the json_rpc_server and fullfill callbacks from outside? Reason for asking is that I'm using ajax-calls to perform tasks on the server but I do not want the browser to hang up on it while waiting for the result. Kind regards, Eric |
From: Rodrigo E. <rod...@gm...> - 2016-02-12 17:15:01
|
Hi Everyone, I decided to give up CppCMS-Embedded and fight with the lighttpd. I configured the lighttpd to execute the application in the "root" of the web service with the following configuration: server.port = 8080 server.bind = "127.0.0.1" fastcgi.server = ( "/" => ( "localhost" => ( "bin-path" => "/home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/hello -c /home/emygdio/Documents/Estudo/Progamacao/C++/CppCms/RootWebServer/etc/config-lighthttpd-2.js", "socket" => "/tmp/hello-fcgi-socket", "fix-root-scriptname" => "enable", "check-local" => "disable", ))) The pretty urls work very well, like http://domain.com/some-pretty-url. But the empty router like this http://domain.com/, still doesn't work. Any assist will be very welcome Thanks 2016-02-12 2:14 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > I think that I need to explain better what I would like expect from the > CppCms. I have a little application that I wrote in Java and have specific > urls indexed by google: > http://domain.com/ --> reflects the main page > http://domain.com/[others-pretty-url] --> reflects each functions of > the application. > The application urls were indexed by google, and I don't want to lose > these urls. I need to rewrite this application in C++ and I decided to use > CppCms. Then I expect to use the same URLs as were indexed by Google. The > main page need to responds the root url (http://domain.com/) and the > other urls need respond like pretty urls ( > http://domain.com/some-pretty-url). > > I did as Artyom tells me to do. Changing the rewrite rules as below: > > change: > > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > > for this: > > { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1"} > > Immediately resolved the problem with the root url, but the rest of urls > stop to work because the server takes the part after the "/" and > concatenates with the /mb.fcgi. Unhappily there isn't any url with no "/" > before them. > I tried overcome that changing the dispatcher configuration of the url, > like that: > > I changed this: > dispatcher().assign("/contact-form",&my_app::contact_form,this); > mapper().assign("contact_form","/contact-form"); > > For this: > dispatcher().assign("contact-form",&my_app::contact_form,this); > mapper().assign("contact_form","contact-form"); > > Unhappily this changing didn't work. > > Anybody has some idea how I can resolve that. > Thanks > > 2016-02-11 20:56 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > >> Hi Artyom, >> >> Thanks very much for your feedback. I tested the virtual main method and >> is executing properly. I changed the regex and the root url works very >> well. The problem now is that any other url just works if I add an extra >> "/" on the begin on the path. >> >> Thanks >> >> 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: >> >>> > class my_app : public cppcms::application{ >>> > public: >>> > my_app(cppcms::service& s) : cppcms::application(s){ >>> > dispatcher().assign("",&my_app::well_come,this); >>> > mapper().assign(""); >>> > mapper().root(""); >>> > } >>> >>> 1st check if cppcms::application::main is called (I think it should) >>> it is virtual >>> member function so you can override it. >>> >>> 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 >>> it is mapped according to the rules to >>> >>> /mb.fcgi/ >>> >>> Than /mb.fcgi is matched and the path you get is "/" >>> >>> When you map to "" you Require empty path and thus it does not get >>> dispatched. >>> >>> The correct is always to map to something starting with "/" or map to >>> "/?" i.e. last "/" is optional. >>> >>> >>> You can also use little bit different rule >>> >>> Instead of this >>> >>> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >>> >>> Use >>> >>> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } >>> >>> Than none of your urls will start from "/" >>> >>> it does not matter how do you do it - just pic and convention and stick >>> to it. >>> >>> Artyom >>> >>> >>> ------------------------------------------------------------------------------ >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>> Monitor end-to-end web transactions and take corrective actions now >>> Troubleshoot faster and improve end-user experience. Signup Now! >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >> >> > |
From: Rodrigo E. <rod...@gm...> - 2016-02-12 04:14:24
|
I think that I need to explain better what I would like expect from the CppCms. I have a little application that I wrote in Java and have specific urls indexed by google: http://domain.com/ --> reflects the main page http://domain.com/[others-pretty-url] --> reflects each functions of the application. The application urls were indexed by google, and I don't want to lose these urls. I need to rewrite this application in C++ and I decided to use CppCms. Then I expect to use the same URLs as were indexed by Google. The main page need to responds the root url (http://domain.com/) and the other urls need respond like pretty urls (http://domain.com/some-pretty-url). I did as Artyom tells me to do. Changing the rewrite rules as below: change: { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } for this: { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1"} Immediately resolved the problem with the root url, but the rest of urls stop to work because the server takes the part after the "/" and concatenates with the /mb.fcgi. Unhappily there isn't any url with no "/" before them. I tried overcome that changing the dispatcher configuration of the url, like that: I changed this: dispatcher().assign("/contact-form",&my_app::contact_form,this); mapper().assign("contact_form","/contact-form"); For this: dispatcher().assign("contact-form",&my_app::contact_form,this); mapper().assign("contact_form","contact-form"); Unhappily this changing didn't work. Anybody has some idea how I can resolve that. Thanks 2016-02-11 20:56 GMT-02:00 Rodrigo Emygdio <rod...@gm...>: > Hi Artyom, > > Thanks very much for your feedback. I tested the virtual main method and > is executing properly. I changed the regex and the root url works very > well. The problem now is that any other url just works if I add an extra > "/" on the begin on the path. > > Thanks > > 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: > >> > class my_app : public cppcms::application{ >> > public: >> > my_app(cppcms::service& s) : cppcms::application(s){ >> > dispatcher().assign("",&my_app::well_come,this); >> > mapper().assign(""); >> > mapper().root(""); >> > } >> >> 1st check if cppcms::application::main is called (I think it should) >> it is virtual >> member function so you can override it. >> >> 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 >> it is mapped according to the rules to >> >> /mb.fcgi/ >> >> Than /mb.fcgi is matched and the path you get is "/" >> >> When you map to "" you Require empty path and thus it does not get >> dispatched. >> >> The correct is always to map to something starting with "/" or map to >> "/?" i.e. last "/" is optional. >> >> >> You can also use little bit different rule >> >> Instead of this >> >> { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } >> >> Use >> >> { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } >> >> Than none of your urls will start from "/" >> >> it does not matter how do you do it - just pic and convention and stick >> to it. >> >> Artyom >> >> >> ------------------------------------------------------------------------------ >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > |
From: Rodrigo E. <rod...@gm...> - 2016-02-11 22:56:46
|
Hi Artyom, Thanks very much for your feedback. I tested the virtual main method and is executing properly. I changed the regex and the root url works very well. The problem now is that any other url just works if I add an extra "/" on the begin on the path. Thanks 2016-02-11 6:10 GMT-02:00 Artyom Beilis <art...@gm...>: > > class my_app : public cppcms::application{ > > public: > > my_app(cppcms::service& s) : cppcms::application(s){ > > dispatcher().assign("",&my_app::well_come,this); > > mapper().assign(""); > > mapper().root(""); > > } > > 1st check if cppcms::application::main is called (I think it should) > it is virtual > member function so you can override it. > > 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 > it is mapped according to the rules to > > /mb.fcgi/ > > Than /mb.fcgi is matched and the path you get is "/" > > When you map to "" you Require empty path and thus it does not get > dispatched. > > The correct is always to map to something starting with "/" or map to > "/?" i.e. last "/" is optional. > > > You can also use little bit different rule > > Instead of this > > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > > Use > > { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } > > Than none of your urls will start from "/" > > it does not matter how do you do it - just pic and convention and stick to > it. > > Artyom > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@gm...> - 2016-02-11 08:10:59
|
> class my_app : public cppcms::application{ > public: > my_app(cppcms::service& s) : cppcms::application(s){ > dispatcher().assign("",&my_app::well_come,this); > mapper().assign(""); > mapper().root(""); > } 1st check if cppcms::application::main is called (I think it should) it is virtual member function so you can override it. 2nd When you access to "localhost:8080" you get request GET / HTTP/1.0 it is mapped according to the rules to /mb.fcgi/ Than /mb.fcgi is matched and the path you get is "/" When you map to "" you Require empty path and thus it does not get dispatched. The correct is always to map to something starting with "/" or map to "/?" i.e. last "/" is optional. You can also use little bit different rule Instead of this { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } Use { "regex" : "/(.*)" , "pattern" : "/mb.fcgi$1" } Than none of your urls will start from "/" it does not matter how do you do it - just pic and convention and stick to it. Artyom |
From: Rodrigo E. <rod...@gm...> - 2016-02-10 22:18:07
|
HI Stanimir, First, thank you very much for your feedback . Yes, I did read both of these documentations. Below have the main class of the example that I'm trying to execute: #include <cppcms/application.h>#include <cppcms/applications_pool.h>#include <cppcms/service.h>#include <cppcms/http_response.h>#include <cppcms/url_dispatcher.h>#include <cppcms/url_mapper.h>#include <iostream>#include "content.h" class my_app : public cppcms::application{ public: my_app(cppcms::service& s) : cppcms::application(s){ dispatcher().assign("",&my_app::well_come,this); mapper().assign(""); mapper().root(""); } void well_come(){ content::index ci; ci.message = "Hello "; render("index",ci); } }; int main(int argc,char ** argv){ try{ cppcms::service srv(argc,argv); srv.applications_pool().mount( cppcms::applications_factory<my_app>() ); srv.run(); }catch(std::exception const & e){ std::cerr<<e.what()<<std::endl; }} Thanks, Rodrigo 2016-02-10 18:28 GMT-02:00 Stanimir Mladenov < sta...@zo...>: > Hello Rodrigo, > > Did you try this documentation > > http://cppcms.com/wikipp/en/page/run_application_web_server_root#CppCMS-Embedded > If it didn't help, then try to put this line in the constructor of > your my_app (the one that inherited from cppcms::application) > > mapper().root(""); > > See here > http://cppcms.com/wikipp/en/page/cppcms_1x_tut_url_mapping#Mapping > > On Wed, Feb 10, 2016 at 8:02 PM, Rodrigo Emygdio > <rod...@gm...> wrote: > > Hi Everyone, > > > > I am trying a simple example with CppCms and I would like to execute all > my > > applications relative to the web application root. I don't want execute > the > > application relative to the script path. Ex localhost: > > 8080/script-path/relative-path-to-my-application, and instead of this, I > > would like the path for my application would be like: localhost: > > 8080/relative-path-to-my-application. I would like to execute this > > application using the CppCMS-Embedded. I am trying a super simple example > > and I had no success. All the time I try the root url > > (http://localhost:8080/) I get a 404 error like that: > > > > > > Connection close > > > > Content-Encoding gzip > > > > Content-Type text/html; charset=utf-8 > > > > Server CppCMS-Embedded/1.1.0 > > > > X-Powered-By CppCMS/1.1.0 > > > > status 404 Not Found > > > > Accept > > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > > > > Accept-Encoding gzip, deflate > > > > Accept-Language en-US,en;q=0.5 > > > > Cache-Control max-age=0 > > > > Connection keep-alive > > > > Cookie _ga=GA1.1.541474771.1454701631 > > > > Host localhost:8080 > > > > User-Agent Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:44.0) > > Gecko/20100101 Firefox/44.0 > > > > Below the config.js of my example: > > > > > > config.js: > > > > { > > "http" : { > > "script" : "/mb.fcgi", > > "rewrite" : [ > > { "regex" : "/media(/.*)?", "pattern" : "$0" }, > > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > > ] > > }, > > "service": { > > "api":"http", > > "port":8080 > > }, > > "views" : { > > "paths" : [ "./" ], > > "skins" : [ "my_app"], > > }, > > } > > > > > > What's I missing in my configurations? Why the CppCMS-Embedded is not > > routing for the web application root . > > > > Thanks. > > > > Rodrigo > > > > > > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Stanimir M. <sta...@zo...> - 2016-02-10 20:53:59
|
Hello Rodrigo, Did you try this documentation http://cppcms.com/wikipp/en/page/run_application_web_server_root#CppCMS-Embedded If it didn't help, then try to put this line in the constructor of your my_app (the one that inherited from cppcms::application) mapper().root(""); See here http://cppcms.com/wikipp/en/page/cppcms_1x_tut_url_mapping#Mapping On Wed, Feb 10, 2016 at 8:02 PM, Rodrigo Emygdio <rod...@gm...> wrote: > Hi Everyone, > > I am trying a simple example with CppCms and I would like to execute all my > applications relative to the web application root. I don't want execute the > application relative to the script path. Ex localhost: > 8080/script-path/relative-path-to-my-application, and instead of this, I > would like the path for my application would be like: localhost: > 8080/relative-path-to-my-application. I would like to execute this > application using the CppCMS-Embedded. I am trying a super simple example > and I had no success. All the time I try the root url > (http://localhost:8080/) I get a 404 error like that: > > > Connection close > > Content-Encoding gzip > > Content-Type text/html; charset=utf-8 > > Server CppCMS-Embedded/1.1.0 > > X-Powered-By CppCMS/1.1.0 > > status 404 Not Found > > Accept > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > > Accept-Encoding gzip, deflate > > Accept-Language en-US,en;q=0.5 > > Cache-Control max-age=0 > > Connection keep-alive > > Cookie _ga=GA1.1.541474771.1454701631 > > Host localhost:8080 > > User-Agent Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:44.0) > Gecko/20100101 Firefox/44.0 > > Below the config.js of my example: > > > config.js: > > { > "http" : { > "script" : "/mb.fcgi", > "rewrite" : [ > { "regex" : "/media(/.*)?", "pattern" : "$0" }, > { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } > ] > }, > "service": { > "api":"http", > "port":8080 > }, > "views" : { > "paths" : [ "./" ], > "skins" : [ "my_app"], > }, > } > > > What's I missing in my configurations? Why the CppCMS-Embedded is not > routing for the web application root . > > Thanks. > > Rodrigo > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Rodrigo E. <rod...@gm...> - 2016-02-10 18:02:53
|
Hi Everyone, I am trying a simple example with CppCms and I would like to execute all my applications relative to the web application root. I don't want execute the application relative to the script path. Ex localhost: 8080/script-path/relative-path-to-my-application, and instead of this, I would like the path for my application would be like: localhost: 8080/relative-path-to-my-application. I would like to execute this application using the CppCMS-Embedded. I am trying a super simple example and I had no success. All the time I try the root url ( http://localhost:8080/) I get a 404 error like that: Connection close Content-Encoding gzip Content-Type text/html; charset=utf-8 Server CppCMS-Embedded/1.1.0 X-Powered-By CppCMS/1.1.0 status 404 Not Found Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Cache-Control max-age=0 Connection keep-alive Cookie _ga=GA1.1.541474771.1454701631 Host localhost:8080 User-Agent Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0 Below the config.js of my example: config.js: { "http" : { "script" : "/mb.fcgi", "rewrite" : [ { "regex" : "/media(/.*)?", "pattern" : "$0" }, { "regex" : ".*" , "pattern" : "/mb.fcgi$0" } ] }, "service": { "api":"http", "port":8080 }, "views" : { "paths" : [ "./" ], "skins" : [ "my_app"], },} What's I missing in my configurations? Why the CppCMS-Embedded is not routing for the web application root . Thanks. Rodrigo |
From: Василий Т. <par...@gm...> - 2016-02-04 13:40:49
|
Unbelivable.. i can't reproduce my recent problem anymore. I broke my head against the wall, but now the simplest code works well. I beg your pardon, Artyom, guys.. I need a vacation i guess.. 2016-02-04 12:46 GMT+03:00 Artyom Beilis <art...@gm...>: > Show the exact full code, it isn't clear what are you doing/trying to do. > > Artyom > > On Thu, Feb 4, 2016 at 11:41 AM, Василий Теркин <par...@gm...> > wrote: > > All the ways to deserialize this string (or alternative - with nested > json > > inside array) to cppcms::json::value give undefined result. > > > > load() stops on '[' or something like that. > > > > (ver.1.0.5) > > > > > > 2016-02-03 9:26 GMT+03:00 Artyom Beilis <art...@gm...>: > >> > >> Please explain me what are you trying to do as it seems to me from the > >> first glance a valid json. > >> > >> Artyom > >> P.S.: As usually I forgot to reply from GMail > >> > >> On Tue, Feb 2, 2016 at 12:08 PM, Василий Теркин <par...@gm...> > >> wrote: > >> > Hello > >> > Is there a way to deal with json arrays like > >> > {"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} > >> > ? > >> > I can't force cppcms to load such string into json without error. > >> > The only way is to use nested array as string value for a while :( > >> > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@gm...> - 2016-02-04 09:46:40
|
Show the exact full code, it isn't clear what are you doing/trying to do. Artyom On Thu, Feb 4, 2016 at 11:41 AM, Василий Теркин <par...@gm...> wrote: > All the ways to deserialize this string (or alternative - with nested json > inside array) to cppcms::json::value give undefined result. > > load() stops on '[' or something like that. > > (ver.1.0.5) > > > 2016-02-03 9:26 GMT+03:00 Artyom Beilis <art...@gm...>: >> >> Please explain me what are you trying to do as it seems to me from the >> first glance a valid json. >> >> Artyom >> P.S.: As usually I forgot to reply from GMail >> >> On Tue, Feb 2, 2016 at 12:08 PM, Василий Теркин <par...@gm...> >> wrote: >> > Hello >> > Is there a way to deal with json arrays like >> > {"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} >> > ? >> > I can't force cppcms to load such string into json without error. >> > The only way is to use nested array as string value for a while :( >> > |
From: Василий Т. <par...@gm...> - 2016-02-04 09:41:26
|
All the ways to deserialize this string (or alternative - with nested json inside array) to cppcms::json::value give undefined result. load() stops on '[' or something like that. (ver.1.0.5) 2016-02-03 9:26 GMT+03:00 Artyom Beilis <art...@gm...>: > Please explain me what are you trying to do as it seems to me from the > first glance a valid json. > > Artyom > P.S.: As usually I forgot to reply from GMail > > On Tue, Feb 2, 2016 at 12:08 PM, Василий Теркин <par...@gm...> > wrote: > > Hello > > Is there a way to deal with json arrays like > > {"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} > > ? > > I can't force cppcms to load such string into json without error. > > The only way is to use nested array as string value for a while :( > > > > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@gm...> - 2016-02-03 06:26:40
|
Please explain me what are you trying to do as it seems to me from the first glance a valid json. Artyom P.S.: As usually I forgot to reply from GMail On Tue, Feb 2, 2016 at 12:08 PM, Василий Теркин <par...@gm...> wrote: > Hello > Is there a way to deal with json arrays like > {"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} > ? > I can't force cppcms to load such string into json without error. > The only way is to use nested array as string value for a while :( > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2016-02-03 06:03:35
|
Please explain me what are you trying to do as it seems to me from the first glance a valid json. Artyom From: Василий Теркин <par...@gm...> To: cpp...@li... Sent: Tuesday, February 2, 2016 12:08 PM Subject: [Cppcms-users] json HelloIs there a way to deal with json arrays like{"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} ?I can't force cppcms to load such string into json without error.The only way is to use nested array as string value for a while :( ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Василий Т. <par...@gm...> - 2016-02-02 10:08:17
|
Hello Is there a way to deal with json arrays like {"units" : [{"id":1,"name":"test1"},{"id":2,"name":"test2"}]} ? I can't force cppcms to load such string into json without error. The only way is to use nested array as string value for a while :( |
From: Artyom B. <art...@gm...> - 2016-01-25 10:26:29
|
On Mon, Jan 25, 2016 at 11:51 AM, CN <cn...@fa...> wrote: > Aha! Artyom, many thanks again for yet another precious lesson of > secured HTML design! > > I do not see this recipe in tutorial. Isn't it a good idea to add it to > "security design" chapter? Not really... It is one of 1000 tricks to work on Bots. If it becomes common than bot would know how to find them. i.e. they wouldn't run entire JS engine but rather search for document.write. See it isn't really security feature as it isn't enhances security it rather limits users who does not run JavaScript to use the form. Which isn't always desirable. It works it particular case but it does not help in general. Fighting spammers is never ending battle that needs you to trick a spammer or detect one. In my bot fight I needed to do many things, sometimes that are very tight to a specific application domain. So there is no "general way to go" Finally it is your effort vs his effort - your trick vs his. It is very different from general secure programming which is about stopping bad guy who knows exactly what are you doing and can do whatever he wants to hack your system. Artyom |
From: CN <cn...@fa...> - 2016-01-25 09:51:42
|
Aha! Artyom, many thanks again for yet another precious lesson of secured HTML design! I do not see this recipe in tutorial. Isn't it a good idea to add it to "security design" chapter? Best Regards, CN On Mon, Jan 25, 2016, at 05:34 PM, Artyom Beilis wrote: > It is simple spam robot filter. > > i.e. most spam bots search HTML for form tag and look the post address > to send some garbage. > Most of them do not run JavaScript so they wouldn't find the address > to post data unless they > write specific code for wikipp - which is likely isn't something bot > writers would bother. > > Simple but yet efficient anti-robot security layer. > > Artyom > > On Mon, Jan 25, 2016 at 11:25 AM, CN <cn...@fa...> wrote: > > Hello! > > > > I noticed below part of file "page.tmpl" in wikipp long time ago. > > > > <script type="text/javascript"> > > <!-- > > document.write('<for') > > document.write('m actio') > > document.write('n="') > > document.write('<%= submit %>" me') > > document.write('thod="po') > > document.write('st">') > > --> > > </script> > > > > I have no idea about the moral of such design, but I did not ask why. I > > think I should not keep pretending understanding it any more! What is > > funny is that trying to figure out why, I ended up running into an > > article saying that document.write() doesn't work with Firefox when it > > encounter xhtml :-) > > > > Could anyone clarify for me: > > Why the most simple and straightforward HTML code "<form>" is not used > > instead? > > > > Thank you in advance! > > Best Regards, > > CN > > > > -- > > http://www.fastmail.com - The way an email service should be > > > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- http://www.fastmail.com - Choose from over 50 domains or use your own |
From: CN <cn...@fa...> - 2016-01-25 09:43:08
|
Thanks for the prompt clarification! I am not debating. As long as its design has nothing to do with attack protection, I will leave it as is. Best Regards, CN On Mon, Jan 25, 2016, at 05:30 PM, mawan sugiyanto wrote: > i think it is not debatable .. just style of programming only .. > > > > On Mon, Jan 25, 2016 at 4:25 PM, CN <cn...@fa...> wrote: >> Hello! >> >> I noticed below part of file "page.tmpl" in wikipp long time ago. >> >> <script type="text/javascript"> >> <!-- >> document.write('<for') >> document.write('m actio') >> document.write('n="') >> document.write('<%= submit %>" me') >> document.write('thod="po') >> document.write('st">') >> --> >> </script> >> >> I have no idea about the moral of such design, but I did not ask why. I >> think I should not keep pretending understanding it any more! What is >> funny is that trying to figure out why, I ended up running into an >> article saying that document.write() doesn't work with Firefox when it >> encounter xhtml :-) >> >> Could anyone clarify for me: >> Why the most simple and straightforward HTML code "<form>" is not used >> instead? >> >> Thank you in advance! >> Best Regards, >> CN >> >> -- >> http://www.fastmail.com - The way an email service should be >> >> >> ------------------------------------------------------------------------------ >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _________________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- http://www.fastmail.com - A fast, anti-spam email service. |
From: Artyom B. <art...@gm...> - 2016-01-25 09:34:46
|
It is simple spam robot filter. i.e. most spam bots search HTML for form tag and look the post address to send some garbage. Most of them do not run JavaScript so they wouldn't find the address to post data unless they write specific code for wikipp - which is likely isn't something bot writers would bother. Simple but yet efficient anti-robot security layer. Artyom On Mon, Jan 25, 2016 at 11:25 AM, CN <cn...@fa...> wrote: > Hello! > > I noticed below part of file "page.tmpl" in wikipp long time ago. > > <script type="text/javascript"> > <!-- > document.write('<for') > document.write('m actio') > document.write('n="') > document.write('<%= submit %>" me') > document.write('thod="po') > document.write('st">') > --> > </script> > > I have no idea about the moral of such design, but I did not ask why. I > think I should not keep pretending understanding it any more! What is > funny is that trying to figure out why, I ended up running into an > article saying that document.write() doesn't work with Firefox when it > encounter xhtml :-) > > Could anyone clarify for me: > Why the most simple and straightforward HTML code "<form>" is not used > instead? > > Thank you in advance! > Best Regards, > CN > > -- > http://www.fastmail.com - The way an email service should be > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: mawan s. <ma...@gm...> - 2016-01-25 09:31:05
|
i think it is not debatable .. just style of programming only .. On Mon, Jan 25, 2016 at 4:25 PM, CN <cn...@fa...> wrote: > Hello! > > I noticed below part of file "page.tmpl" in wikipp long time ago. > > <script type="text/javascript"> > <!-- > document.write('<for') > document.write('m actio') > document.write('n="') > document.write('<%= submit %>" me') > document.write('thod="po') > document.write('st">') > --> > </script> > > I have no idea about the moral of such design, but I did not ask why. I > think I should not keep pretending understanding it any more! What is > funny is that trying to figure out why, I ended up running into an > article saying that document.write() doesn't work with Firefox when it > encounter xhtml :-) > > Could anyone clarify for me: > Why the most simple and straightforward HTML code "<form>" is not used > instead? > > Thank you in advance! > Best Regards, > CN > > -- > http://www.fastmail.com - The way an email service should be > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |