Hello,

this is actually a little complicated. And indeed the answer, you are referring to is not quite right. This time I tested my answer before posting a reply.

The call is scallComp instead of just scall. You need to pass the component identifier and a request to the component to get the result. The component identifier can be specified as a string. In your case "static".

The request specifies, what to request. This multibinary component uses the path info of the request to specify, which object to address. So you need to create a http request object and set the path info. The easiest way to create a http request object is to make a copy of the current, which is passed with the parameter name "request". To set the path info there is a method "setPathInfo".

So here we go:

   tnt::HttpRequest r(request);
   r.setPathInfo("resources/myWebApp.css");
   std::string bodyData = scallComp("resources", r);
   reply.sout() << b;

What you do not get is the mime type of it. This is more difficult. "scallComp" do not provide this. You should really consider to do a external redirect in your application if you need it.


Tommi


Am 05.07.2016 um 19:57 schrieb Hannibal99:
Hello,

I'm a newbie an running some trials with tntnet.

What I would like to achieve: call a page from a static module.

What I did:

ecpp -v -bb  -o ../src/ecpp/static/static.cpp --mimetypes mime_types/mime.types 
-n static -p

for all static files (including some .html files, for example a file
startpage.html). This is making a single file src/ecpp_target/static/static.cpp 
which I am
running within one single app. Everthing works fine.

But now I would like to "redirect" with a new reply by
internally calling the /startpage.html, getting its reply body
and transferring it to the originating reply - the way I found
it here:

https://sourceforge.net/p/tntnet/mailman/message/34869991/

<%cpp>
   std::string picture = scall("picture@...");
</%cpp>

But I do not have a dedicated Module but an URL within the
static component. What's the way to do this?


Thanks!

hannibalbarkas



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to