public void write(Object obj, OutputStream out) throws IOException
{
if (trace) { log.trace("Writing " + obj); }
DataOutputStream dos;
if (out instanceof DataOutputStream)
{
//For non HTTP transports - we should ALWAYS be passed a DataOutputStream
//We do this by specifying socket wrapper classes on the locator uri
dos = (DataOutputStream)out;
if (trace) { log.trace("Stream is a DataOutputStream"); }
}
else
{
// Further sanity check
if (out instanceof ObjectOutputStream)
{
throw new IllegalArgumentException("Invalid stream - are you sure you have " +
"configured socket wrappers?");
}
// This would be the case for the HTTP transport for example. Wrap the stream.
//FIXME - remoting should be fixed to allow socket wrappers to be specified for
//all transports - not just socket
//until then we have no choice but to create a wrapping stream on every invocation
//for HTTP transport
dos = new DataOutputStream(out);
if (trace) { log.trace("Stream is NOT a DataOutputStream - must be using HTTP transport"); }
}
try