Re: [Cppcms-users] CppCMS-Embedded web root
Brought to you by:
artyom-beilis
|
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
>
|