@Nagaev

> Compilation:
> $ g++ 1.cpp -o 1 -lwt -lwthttp
>
> Run:
> $ ./1 --http-port 8000 --http-address 0.0.0.0 --docroot .
>
> Access:
> $ curl http://0.0.0.0:8000/hello
> Hello World!
>
> It should work.
>

Yep, it worked! Thank you very much!


> For static resources, no extra requests are performed: you just get
> (through HTTP) output of handleRequest.
>
> It should work as well with any type of connector (fcgi or isapi) or
> when wthttp is used through reverse proxy (like nginx or apache
> http_proxy).

There is a slight change from how the RESTful API is accessed when
using via FCGI connector. For the example code used above, the URI for
accessing the resource via FCGI connector will then be:

curl http://0.0.0.0:8000/1.wt/hello

instead of

curl http://0.0.0.0:8000/hello

which is valid for (only?) wthttp. Thanks to Koen for pointing that
out on the Wt help mailing list (post title: "Non-web client and
Wt...").


> But it is not how RESTful API should be implemented for Wt.
> imho, you should use normal WApplication and connect
> internalPathChanged() signal to handler function, that would create
> WText("Hello");
>
> In this case you'll get additional requests (application
> initialization, javascript, etc).
> And "Hello" would not be raw HTTP contents (as in 1.cpp), but a part of HTML.
>
> Full example see attached file 2.cpp
>

Thanks for that suggestion. But I am looking for non-Wt clients to
access the resources exposed by Wt backend. I have detailed my
requirements on the Wt Help mailing list on Wt support website. You
can view my post and the ensuing discussion on that mailing list if
your are interested in knowing what I am trying to achieve with
RESTful services using Wt.

Thanks and regards,

~Plug

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to