From c3c3b98cc9f0114ec9d226db4bc39cca3fec882f Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Wed, 3 Sep 2008 00:14:44 +0000 Subject: 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 --- .../provider/WidgetImplementationInvoker.java | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'java') 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 + "\");"); } } } -- cgit v1.2.3