From c4de801fcb55b6ca0c8c12777007948eeb7a9e79 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 25 Jan 2010 07:28:50 +0000 Subject: Added skeletons and build options for a few more utility components. Minor refactoring of the web service component. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@902721 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/http/httpd.hpp | 14 ++++++++++++++ sca-cpp/trunk/modules/server/mod-eval.hpp | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'sca-cpp/trunk/modules') diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp index 4a3e5d0f58..1e8f2a80b5 100644 --- a/sca-cpp/trunk/modules/http/httpd.hpp +++ b/sca-cpp/trunk/modules/http/httpd.hpp @@ -264,6 +264,20 @@ const int reportStatus(const failable& rc) { return content(rc); } +/** + * Convert an HTTPD request struct to a value + */ +const value requestValue(request_rec* r) { + return value((const value*)r); +} + +/** + * Convert a value to an HTTPD request struc + */ +request_rec* request(const value& v) { + return (request_rec*)(const value*)gc_ptr(v); +} + } } diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp index dfc376c55c..aaf31f2b18 100644 --- a/sca-cpp/trunk/modules/server/mod-eval.hpp +++ b/sca-cpp/trunk/modules/server/mod-eval.hpp @@ -169,7 +169,12 @@ const failable post(request_rec* r, const lambda&)> return OK; } - return HTTP_NOT_IMPLEMENTED; + // Unknown content type, wrap the HTTP request struct in a value and pass it to + // the component implementation function + const failable val = failableResult(impl(cons("handle", mklist(httpd::requestValue(r))))); + if (!hasContent(val)) + return mkfailure(reason(val)); + return OK; } /** -- cgit v1.2.3