case "string": objects.setElementAt(new String(content.getBuf(), 0, content.size()), objects.size() - 1);
case "double": objects.setElementAt(new Double(new String(content.getBuf(), 0, content.size())), objects.size() - 1);
case "base64":
- objects.setElementAt(new Stream.ByteArray(Base64.decode(new String(content.getBuf(), 0, content.size())),
+ objects.setElementAt(new Fountain.ByteArray(Base64.decode(new String(content.getBuf(), 0, content.size())),
null), objects.size() - 1);
case "name": objects.addElement(new String(content.getBuf(), 0, content.size()));
case "value": if ("".equals(objects.lastElement()))
sb.append(((Boolean)o).booleanValue() ? "1" : "0");
sb.append("</boolean></value>\n");
- } else if (o instanceof Stream) {
+ } else if (o instanceof Fountain) {
try {
sb.append(" <value><base64>\n");
- InputStream is = ((Stream)o).getInputStream();
+ InputStream is = ((Fountain)o).getInputStream();
byte[] buf = new byte[54];
while(true) {
int numread = is.read(buf, 0, 54);
}
sb.append("\n </base64></value>\n");
} catch (IOException e) {
- if (Log.on) Log.info(this, "caught IOException while attempting to send a ByteStream via XML-RPC");
+ if (Log.on) Log.info(this, "caught IOException while attempting to send a Fountain via XML-RPC");
if (Log.on) Log.info(this, e);
- throw new JSExn("caught IOException while attempting to send a ByteStream via XML-RPC");
+ throw new JSExn("caught IOException while attempting to send a Fountain via XML-RPC");
}
} else if (o instanceof String) {
// Call Sequence //////////////////////////////////////////////////////////////////////////
+ /* FIXME this has been disabled to make XMLRPC usable without Scheduler
public final Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
JSArray args = new JSArray();
for(int i=0; i<nargs; i++) args.addElement(i==0?a0:i==1?a1:i==2?a2:rest[i-3]);
throw new JSExn("cannot invoke an XML-RPC call in the foreground thread");
}
}
+ */
- final void call(final JS.UnpauseCallback callback, final JSArray args) {
+ // FIXME need to reenable backgrounding logic
+ final Object call(final JS.UnpauseCallback callback, final JSArray args) {
try {
if (Log.rpc) Log.info(this, "call to " + url + " : " + method);
if (tracker == null) tracker = new Hash();
if (objects == null) objects = new Vec();
String request = buildRequest(args);
if (Log.rpc) Log.info(this, "send:\n" + request);
- InputStream is = http.POST("text/xml", request);
+ InputStream is = http.POST("text/xml", request, null, null);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
new Helper().parse(br);
final Object result = fault ? new JSExn(objects.elementAt(0)) : objects.size() == 0 ? null : objects.elementAt(0);
- Scheduler.add(new Task() { public void perform() throws JSExn { callback.unpause(result); }});
+ return (new Task() { public void perform() throws JSExn { callback.unpause(result); }});
} finally {
tracker.clear();
objects.setSize(0);
}
} catch (final JSExn e) {
final Exception e2 = e;
- Scheduler.add(new Task() { public void perform() throws JSExn { callback.unpause(e2); }});
+ return (new Task() { public void perform() throws JSExn { callback.unpause(e2); }});
} catch (final IOException e) {
final Exception e2 = e;
- Scheduler.add(new Task() { public void perform() throws JSExn { callback.unpause(new JSExn(e2)); }});
+ return (new Task() { public void perform() throws JSExn { callback.unpause(new JSExn(e2)); }});
} catch (final XML.Exn e) {
final Exception e2 = e;
- Scheduler.add(new Task() { public void perform() throws JSExn { callback.unpause(new JSExn(e2)); }});
+ return (new Task() { public void perform() throws JSExn { callback.unpause(new JSExn(e2)); }});
}
}
}