Hi Tommi!
Thank you for the good tips! I took the second hint (see below), which
works properly with thies ecpp-Code:
------------- snip ------------------
<%pre>
</%pre>
<%args>
std::string myname;
</%args>
<%cpp>
request.setPathInfo("/home/oliver/" + myname);
return callComp("static@tntnet", request, reply, qparam);
</%cpp>
------------- snap ------------------
I.e.running "http://localhost:8000?myname=liztest2.txt" in firefox gets
the content of the file "liztest2.txt" :-)
So far, so good. But in the error-output of tntnet there is a strange
http-error (last line):
------------- snip ------------------
$ tntnet -c tntnet.conf
tntnet 2.1
2012-11-08 14:48:33.91977 [11567.140491976750912] INFO tntnet.listener -
listen ip= port=8000
2012-11-08 14:48:33.92019 [11567.140491976750912] INFO tntnet.tntnet -
create 5 worker threads
2012-11-08 14:48:39.20858 [11567.140491943319296] INFO tntnet.worker -
request GET /?myname=liztest2.txt from client 127.0.0.1 user-Agent
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko)
Chrome/22.0.1250.0 Iron/22.0.2150.0 Safari/537.4" user ""
2012-11-08 14:48:39.20894 [11567.140491943319296] INFO tntnet.comploader
- load library "lizserv"
2012-11-08 14:48:39.20911 [11567.140491943319296] INFO tntnet.comploader
- library "./lizserv.so"
2012-11-08 14:48:39.20918 [11567.140491943319296] INFO tntnet.comploader
- load library "tntnet"
2012-11-08 14:48:39.20924 [11567.140491943319296] WARN tntnet.comploader
- failed to load library "./tntnet"
2012-11-08 14:48:39.20950 [11567.140491943319296] INFO tntnet.comploader
- library "/usr/lib/tntnet/tntnet.so"
2012-11-08 14:48:39.21111 [11567.140491943319296] INFO tntnet.worker -
request GET /?myname=liztest2.txt ready, returncode 304 Not Modified -
ContentSize: 0
2012-11-08 14:48:39.42957 [11567.140491934926592] INFO tntnet.worker -
request GET /favicon.ico from client 127.0.0.1 user-Agent "Mozilla/5.0
(X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko)
Chrome/22.0.1250.0 Iron/22.0.2150.0 Safari/537.4" user ""
2012-11-08 14:48:39.42991 [11567.140491934926592] WARN tntnet.worker -
http-Error: 404 Not Found
------------- snap ------------------
This doesnt matter for functionality, but i would like to understand the
origin of this http-Error.
Tfh!
Oliver
Am 29.10.2012 19:28, schrieb Tommi Mäkitalo:
> Am 27.10.2012 16:27, schrieb Oliver Rath:
>> Hi list,
>>
>> in tntnet i can offer files easily bei the static component, addressed
>> by regex. This is fine, if you requst the files directly.
>>
>> But how do a send a file dynamicly?`I.e. a client requests via
>> parameters like
>> http://example.xom?name=oliver&code=Abc6633&ask=textfile2.txt
>>
>> How can I return i.e. now the file /var/www/oliver/textfile2.txt ? Do i
>> have to open it and send it byte by byte? Can this be done via
>> header-instructions of htttp?
>>
>> Tfh!
>>
>> Oliver
>>
> You can of course just open the file and send it to the client. But you
> have to set the content type also.
>
> Another option is to reply with a redirect using:
>
> reply.redirect(ThePathToTheFile).
>
> Or you call the static component as a sub component after setting the
> path info. Like this:
>
> request.setPathInfo("thePathToTheFile");
>
> return callComp("static@tntnet", request, reply, qparam);
>
> Or from html:
>
> % request.setPathInfo("thePathToTheFile");
>
> <& static@tntnet >
>
> But in html you have to be really careful not to add white space to the
> content.
>
>
> Tommi
>
> ------------------------------------------------------------------------------
> The Windows 8 Center - In partnership with Sourceforge
> Your idea - your app - 30 days.
> Get started!
> http://windows8center.sourceforge.net/
> what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general