summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-24 02:54:32 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-24 02:54:32 +0000
commite5f662ac57fa2c54882245e1c568e0982abab4fb (patch)
treefb658799ecc494bbf21a87335eac46f0ba6596b3 /sca-cpp/trunk
parenta4f8fcde0e7d4a592eb07628a08b5534abdb2613 (diff)
Preserve HTTP request path when routing a request through a component reference.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1052431 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk')
-rw-r--r--sca-cpp/trunk/modules/server/mod-wiring.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/sca-cpp/trunk/modules/server/mod-wiring.cpp b/sca-cpp/trunk/modules/server/mod-wiring.cpp
index 67b179e7a1..e873733939 100644
--- a/sca-cpp/trunk/modules/server/mod-wiring.cpp
+++ b/sca-cpp/trunk/modules/server/mod-wiring.cpp
@@ -102,10 +102,13 @@ int translateReference(const ServerConf& sc, request_rec *r) {
debug(target, "modwiring::translateReference::target");
// Route to an absolute target URI using mod_proxy or an HTTP client redirect
+ const list<value> pathInfo = cdddr(rpath);
if (httpd::isAbsolute(target)) {
if (useModProxy) {
- // Build proxy URI using current request's protocol scheme
- r->filename = apr_pstrdup(r->pool, c_str(string("proxy:") + httpd::scheme(r) + substr(target, find(target, "://"))));
+ // Build proxy URI
+ // current request's protocol scheme, reference target uri and request path info
+ string turi = httpd::scheme(r) + substr(target, find(target, "://")) + path(pathInfo);
+ r->filename = apr_pstrdup(r->pool, c_str(string("proxy:") + turi));
debug(r->filename, "modwiring::translateReference::filename");
r->proxyreq = PROXYREQ_REVERSE;
r->handler = "proxy-server";
@@ -118,7 +121,10 @@ int translateReference(const ServerConf& sc, request_rec *r) {
}
// Route to a relative target URI using a local internal redirect
- r->filename = apr_pstrdup(r->pool, c_str(string("/redirect:/components/") + substr(target, 0, find(target, '/'))));
+ // /components/, target component name and request path info
+ const value tname = substr(target, 0, find(target, '/'));
+ const string tpath = path(cons(tname, pathInfo));
+ r->filename = apr_pstrdup(r->pool, c_str(string("/redirect:/components") + tpath));
debug(r->filename, "modwiring::translateReference::filename");
r->handler = "mod_tuscany_wiring";
return OK;