diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-03 00:14:44 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-03 00:14:44 +0000 |
commit | c3c3b98cc9f0114ec9d226db4bc39cca3fec882f (patch) | |
tree | ea8414d76775fd9b0b28c48100d7dc56a211518e /java/sca | |
parent | 124d6367f60f0e34ea7cb98a1cf48a45b8699560 (diff) |
Fix for TUSCANY-2570, configure Widget client proxies with relative paths.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@691443 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | java/sca/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/java/sca/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java b/java/sca/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java index 7a8d780366..49f7a4e120 100644 --- a/java/sca/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java +++ b/java/sca/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java @@ -223,22 +223,20 @@ class WidgetImplementationInvoker implements Invoker { String proxyClient = WidgetProxyHelper.getJavaScriptProxyClient(binding.getClass().getName()); if(proxyClient != null) { - // Convert the local host to the acutal name of local host + // Generate the JavaScript proxy configuration code + // Proxies are configured with the target URI path, as at this point we shouldn't + // be generating proxies that communicate with other hosts (if a proxy needs to + // communicate with another host it should be generated on and served by + // that particular host) URI targetURI = URI.create(binding.getURI()); - if ("localhost".equals(targetURI.getHost())) { - try { - String host = InetAddress.getLocalHost().getHostName(); - targetURI = new URI(targetURI.getScheme(), targetURI.getUserInfo(), - host, targetURI.getPort(), - targetURI.getPath(), targetURI.getQuery(), targetURI.getFragment()); - } catch (UnknownHostException e) { - } - } + String targetPath = targetURI.getPath(); if(proxyClient.equals("JSONRpcClient")) { - pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetURI + "\").Service;"); + //FIXME Proxies should follow the same pattern, saving us from having to test + // for JSONRpc here + pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetPath + "\").Service;"); } else { - pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetURI + "\");"); + pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetPath + "\");"); } } } |