X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FXMLRPC.java;h=274b5ef84b21277c767ef66e5213ce58ea6f6161;hb=91fa83b19ed238ac066428f1305e860b7ae10cc6;hp=3201ecd312696008d71e2784a7679f9d8ba8774a;hpb=36c7cba0672b0b0ac61f484a918a34969100ca92;p=org.ibex.core.git diff --git a/src/org/xwt/XMLRPC.java b/src/org/xwt/XMLRPC.java index 3201ecd..274b5ef 100644 --- a/src/org/xwt/XMLRPC.java +++ b/src/org/xwt/XMLRPC.java @@ -230,14 +230,21 @@ class XMLRPC extends XML implements Function { } } - private Object connect(Object[] args) throws JavaScriptException, IOException { + public Object call(Object[] args) throws JavaScriptException, IOException { if (Log.verbose) Log.log(this, "call to " + url + " : " + methodname); + + if (tracker == null) tracker = new Hash(); + else tracker.clear(); + + if (objects == null) objects = new Vec(); + else objects.setSize(0); + HTTP http = new HTTP(url); String content = send(args, http); OutputStream os = new BufferedOutputStream(http.getOutputStream(content.length(), "text/xml"), 4000); PrintWriter ps = !Log.verbose ? new PrintWriter(os) : - new PrintWriter(new FilterWriter(os)) { + new PrintWriter(new FilterWriter(new OutputStreamWriter(os)) { public void write(int i) throws IOException { super.write(i); if (Log.on) Log.log(this, "send: " + ((char)i)); @@ -274,7 +281,7 @@ class XMLRPC extends XML implements Function { return recieve(br); } - protected String send(Object[] args, HTTP http) throws JavaScriptException { + protected String send(Object[] args, HTTP http) throws JavaScriptException, IOException { StringBuffer content = new StringBuffer(); content.append("\n"); content.append(" \n"); @@ -310,12 +317,6 @@ class XMLRPC extends XML implements Function { public final Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args) throws JavaScriptException { - if (tracker == null) tracker = new Hash(); - else tracker.clear(); - - if (objects == null) objects = new Vec(); - else objects.setSize(0); - // put ourselves in the background Thread thread = Thread.currentThread(); if (!(thread instanceof ThreadMessage)) { @@ -327,7 +328,7 @@ class XMLRPC extends XML implements Function { mythread.done.release(); try { - return connect(args); + return call(args); } catch (IOException se) { if (Log.on) Log.log(this, se);