From 20a36196a7aad4f863dbc4969ff648bcbc187a02 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 12 Jul 2010 15:19:11 +0000 Subject: Add a host component property reporting the current virtual host name. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@963318 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/server/mod-eval.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sca-cpp/trunk/modules/server/mod-eval.hpp') diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp index ded496a0bf..829edef387 100644 --- a/sca-cpp/trunk/modules/server/mod-eval.hpp +++ b/sca-cpp/trunk/modules/server/mod-eval.hpp @@ -275,11 +275,11 @@ const list refProxies(const list& refs, const string& base, const #ifdef WANT_THREADS __thread #endif -const request_rec* currentRequest = NULL; +request_rec* currentRequest = NULL; class ScopedRequest { public: - ScopedRequest(const request_rec* r) { + ScopedRequest(request_rec* r) { currentRequest = r; } @@ -290,7 +290,7 @@ public: /** * Convert a list of component properties to a list of lambda functions that just return - * the property value. The user and email properties are configured with the values + * the property value. The host, user and email properties are configured with the values * from the HTTP request, if any. */ struct propProxy { @@ -302,6 +302,15 @@ struct propProxy { } }; +struct hostPropProxy { + const value v; + hostPropProxy(const value& v) : v(v) { + } + const value operator()(unused const list& params) const { + return httpd::hostName(currentRequest, v); + } +}; + struct emailPropProxy { const value v; emailPropProxy(const value& v) : v(v) { @@ -326,6 +335,8 @@ struct userPropProxy { }; const value mkpropProxy(const value& prop) { + if (scdl::name(prop) == "host") + return lambda&)>(hostPropProxy(elementValue(prop))); if (scdl::name(prop) == "email") return lambda&)>(emailPropProxy(elementValue(prop))); if (scdl::name(prop) == "user") -- cgit v1.2.3