}
}
- 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));
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("<?xml version=\"1.0\"?>\n");
content.append(" <methodCall>\n");
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)) {
mythread.done.release();
try {
- return connect(args);
+ return call(args);
} catch (IOException se) {
if (Log.on) Log.log(this, se);