Support #446
closedUsing wt for a RESTful API
0%
Description
I came across the wt toolkit a liitle while back and have been 'kicking the tires' a bit whenever I had some free time.
I have successfully written a 'hello world' wt application but rather than using wt as a web application, I want to use wt to implement a 'pure' web srevice.
I am thinking of using wt to provide to provide RESTful services from a C application. I have been looking for an example or two that will show how to build a RESTful API consisting of the following methods:
a). a method that returns a txt/html document
b). a method that returns an XML document
c). a method that returns a JSON string
d). a method that returns an octet stream (i.e. binary data)
Could anyone familiar enough with wt, demonstrate how I can write functions that return the various data types listed above, from my test application ?
Updated by Koen Deforche over 14 years ago
Hey,
You need to take a look at http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WResource.html.
In WResource::handleRequest() you have the complete freedom to generate a response of the appropriate type in response to a request.
Regards,
koen
Updated by Pieter Libin over 14 years ago
- Status changed from Resolved to Closed