Le 13/04/2012 22:37, Tommi Mäkitalo a écrit :
> Am 13.04.2012 08:11, schrieb Jean-Michel Caricand:
>> Hello,
>>
>> I created these RESTFul services :
>>
>> <%pre>
>> #include<iostream>
>> #include<sstream>
>> #include<string>
>> #include<vector>
>> </%pre>
>> <%cpp>
>>
>> if (request.getMethod() == "GET")
>> {
>> log_info("GET getBody() "<< request.getBody());
>> }
>> else if (request.getMethod() == "POST")
>> {
>> log_info("POST getBody() "<< request.getBody());
>> std::istringstream data(request.getBody());
>> std::cerr<< data<< std::endl;
>> }
>> else if (request.getMethod() == "PUT")
>> {
> Hi again,
>
> I just forgot to mention one thing. I saw in your server code this
> "std::cerr<< data<< std::endl;". This is strange. As far as I know,
> this is not standard. Normally you can't output a std::istringstream to
> a std::ostream. I was suprised, that it worked.
>
> But your question leads me to an idea. What do you (all) think about
> extending this url mapping with the method. If you can configure
> something like:
>
> mapUrlGET "^/(.*)$" $1_GET@myapp
> mapUrlPOST "^/(.*)$" $1_POST@myapp
>
> Then you can code a component named "test_GET", which is called with the
> url "/test" but only when the method is "GET" and a component
> "test_POST", which is called when the method is "POST". You do not have
> to dispatch it yourself then.
>
>
> Tommi
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general
I think it's a great idea :)
Jean-Michel
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general