// ============================================================================ // This is a Servlet sample for the G-WAN Web Server (http://www.trustleap.com) // ---------------------------------------------------------------------------- // hello.c: just used with ab (ApacheBench) to benchmark a minimalist servlet // ============================================================================ // imported functions: // get_reply(): get a pointer on the 'reply' dynamic buffer from the server // set_reply(): send back the 'reply' dynamic buffer's pointer to the server // xbuf_cat(): like strcat(), but it works in the specified dynamic buffer // ---------------------------------------------------------------------------- #include "xbuffer.h" // G-WAN dynamic buffers int main(int argc, char *argv[]) { // --------------------- Servlet Header ---------------------------------- // create a dynamic buffer and get a pointer on the server response buffer xbuf_ctx reply; get_reply(argv, &reply); // --------------------- Servlet Body ------------------------------------ // format a response xbuf_cat(&reply, "HELLO WORLD"); // --------------------- Servlet Footer ---------------------------------- // confirm the reply's dynamic buffer address and size to the server // (they have changed when more memory is allocated during formatting) set_reply(argv, &reply); return(200); // return an HTTP code (200:'OK') } // ============================================================================ // End of Source Code // ============================================================================