FormField formField = new FormField(param);
fileParams.put(entry.getKey(), formField);
}
CallBatch batch = new CallBatch(fileParams, false);
Calls calls = plainCallHandler.marshallInbound(batch);
log.debug("Calls="+calls);
for (int i = 0; i < calls.getCallCount(); i++)
{
Call call = calls.getCall(i);
Object[] params = call.getParameters();
log.debug("Call[" + i + "]=" + call.getScriptName() + "." + call.getMethodName() + (params == null ? "[]" : Arrays.asList(params)));
}
Replies replies = remoter.execute(calls);
ScriptConduit conduit = new BayeuxScriptConduit(converterManager, JSON_OUTPUT);
for (Reply reply : replies)
{
String batchId = calls.getBatchId();
log.debug("Reply="+reply+" BatchId="+batchId);
if (reply.getThrowable() != null)
{
Throwable ex = reply.getThrowable();
ScriptBuffer script = EnginePrivate.getRemoteHandleExceptionScript(batchId, reply.getCallId(), ex);
conduit.addScript(script);
log.warn("--Erroring: batchId[" + batchId + "] message[" + ex.toString() + ']');
}
else
{
Object data = reply.getReply();
log.debug("data="+data);
ScriptBuffer script = EnginePrivate.getRemoteHandleCallbackScript(batchId, reply.getCallId(), data);
conduit.addScript(script);
}
}
String output = conduit.toString();
log.debug("<< "+output);
Channel channel = bayeux.getChannel("/dwr" + fromClient.getId(), true);
channel.publish(client, output, calls.getBatchId());
}
catch (Exception ex)
{
log.warn("Protocol Error", ex);
}