home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 136
/
MOBICLIC136.ISO
/
pc
/
DATA
/
HOTE
/
libs
/
amfphp
/
amfphp.swf
/
scripts
/
__Packages
/
mx
/
remoting
/
debug
/
ConnectionMixin.as
next >
Wrap
Text File
|
2011-07-20
|
7KB
|
216 lines
class mx.remoting.debug.ConnectionMixin extends Object
{
static var _attached = false;
function ConnectionMixin()
{
super();
}
static function initialize()
{
var _loc1_ = mx.remoting.Connection.prototype;
var _loc2_ = mx.remoting.debug.ConnectionMixin.prototype;
if(!_loc1_.netDebugProxyFunctions)
{
_loc1_.netDebugProxyFunctions = true;
_loc1_.realConnect = _loc1_.connect;
_loc1_.realCall = _loc1_.call;
_loc1_.realClose = _loc1_.close;
_loc1_.realAddHeader = _loc1_.addHeader;
_loc1_.connect = _loc2_.netDebugProxyConnect;
_loc1_.call = _loc2_.netDebugProxyCall;
_loc1_.close = _loc2_.netDebugProxyClose;
_loc1_.addHeader = _loc2_.netDebugProxyAddHeader;
_loc1_.attachDebug = _loc2_.attachDebug;
_loc1_.sendDebugEvent = _loc2_.sendDebugEvent;
_loc1_.sendServerEvent = _loc2_.sendServerEvent;
_loc1_.sendClientEvent = _loc2_.sendClientEvent;
_loc1_.addNetDebugHeader = _loc2_.addNetDebugHeader;
_loc1_.updateConfig = _loc2_.updateConfig;
_loc1_.getNetDebug = _loc2_.getNetDebug;
_loc1_.isRealTime = _loc2_.isRealTime;
_loc1_.setupRecordSet = _loc2_.setupRecordSet;
_loc1_.setDebugId = _loc2_.setDebugId;
_loc1_.getDebugId = _loc2_.getDebugId;
_loc1_.getDebugConfig = _loc2_.getDebugConfig;
_loc1_.trace = _loc2_.trace;
return true;
}
return false;
}
function attachDebug()
{
var _loc1_ = this;
if(!mx.remoting.debug.ConnectionMixin._attached)
{
mx.remoting.debug.ConnectionMixin._attached = true;
_loc1_._headerAdded = false;
_loc1_._configured = false;
_loc1_._config = new mx.remoting.debug.NetDebugConfig();
mx.utils.ObjectCopy.copyProperties(_loc1_._config,_loc1_.getNetDebug().getConfig());
_loc1_._protocol = "none";
_loc1_._id = String(_loc1_.getNetDebug().addNetConnection(_loc1_));
}
}
function sendDebugEvent(eventobj)
{
var _loc1_ = this;
var _loc2_ = eventobj;
_loc2_.protocol = _loc1_._protocol;
_loc2_.debugId = _loc1_._id;
return _loc1_.getNetDebug().onEvent(_loc2_);
}
function sendServerEvent(eventobj)
{
eventobj.movieUrl = unescape(_root._url);
if(this.sendDebugEvent(eventobj))
{
}
}
function sendClientEvent(eventobj)
{
var _loc1_ = this;
if(_loc1_._config.m_debug && _loc1_._config.client.m_debug)
{
if(_loc1_._config.client.http && _loc1_._protocol == "http" || _loc1_._config.client.rtmp && _loc1_._protocol.substr(0,4) == "rtmp")
{
if(_loc1_.sendDebugEvent(eventobj))
{
}
}
}
}
function addNetDebugHeader()
{
var _loc1_ = this;
if(!_loc1_._headerAdded)
{
_loc1_._headerAdded = true;
if(_loc1_._config.m_debug && _loc1_._config.app_server.m_debug && _loc1_._protocol == "http")
{
_loc1_.realAddHeader("amf_server_debug",true,_loc1_._config.app_server);
}
else
{
_loc1_.realAddHeader("amf_server_debug",true,undefined);
}
}
}
function updateConfig(config)
{
var _loc1_ = this;
var _loc2_ = config;
_loc1_.attachDebug();
if(_loc2_ == null && !_loc1_._configured)
{
_loc1_._configured = true;
_loc2_ = mx.remoting.debug.NetDebugConfig.getRealDefaultNetDebugConfig();
}
mx.utils.ObjectCopy.copyProperties(_loc1_._config,_loc2_);
_loc1_._headerAdded = false;
}
function isRealTime()
{
return this._protocol.substr(0,4) == "rtmp";
}
function setupRecordSet()
{
var _loc1_ = this;
_loc1_.attachDebug();
_loc1_._config.client.http = _loc1_._config.client.recordset;
}
function netDebugProxyConnect()
{
var _loc1_ = this;
var _loc2_ = arguments;
_loc1_.attachDebug();
var _loc3_ = _loc2_[0].substr(0,4);
if(_loc3_ == "http" || _loc3_.substr(0,4) == "rtmp")
{
if(_loc2_[0].charAt(4) == ":")
{
_loc1_._protocol = _loc3_;
}
else
{
_loc1_._protocol = _loc2_[0].substr(0,5);
}
}
else
{
_loc1_._protocol = "http";
}
_loc1_.sendClientEvent(new mx.remoting.debug.events.NetDebugConnect(_loc2_));
if(_loc1_.isRealTime())
{
_loc1_._connectString = _loc2_[0];
_loc1_.getNetDebug().sendCommand(new mx.remoting.debug.commands.StartRTMPTrace(_loc2_[0]));
var ret = _loc1_.realConnect.apply(_loc1_,_loc2_);
_loc1_.realCall("@getClientID",new mx.remoting.RTMPClientIDResponse(_loc2_[0],_loc1_));
return ret;
}
return Boolean(_loc1_.realConnect.apply(_loc1_,_loc2_));
}
function netDebugProxyCall()
{
var _loc1_ = this;
var _loc2_ = arguments;
_loc1_.attachDebug();
_loc1_.sendClientEvent(new mx.remoting.debug.events.NetDebugCall(_loc2_));
_loc1_.addNetDebugHeader();
if(_loc1_._config.app_server)
{
_loc2_[1] = new mx.remoting.debug.NetDebugResponseProxy(_loc1_,_loc2_[1]);
return Boolean(_loc1_.realCall.apply(_loc1_,_loc2_));
}
return Boolean(_loc1_.realCall.apply(_loc1_,_loc2_));
}
function netDebugProxyClose()
{
var _loc1_ = this;
_loc1_.attachDebug();
_loc1_.sendClientEvent(new mx.remoting.debug.events.NetDebugClose());
if(_loc1_.isRealTime())
{
_loc1_.getNetDebug().sendCommand(new mx.remoting.debug.commands.StopRTMPTrace(_loc1_._connectString,_loc1_._clientId));
}
var _loc2_ = _loc1_.realClose();
_loc1_.getNetDebug().removeNetConnection(_loc1_);
return _loc2_;
}
function netDebugProxyAddHeader()
{
var _loc1_ = this;
_loc1_.attachDebug();
_loc1_.sendClientEvent(new mx.remoting.debug.events.NetDebugAddHeader(arguments));
return Boolean(_loc1_.realAddHeader.apply(_loc1_,arguments));
}
function setDebugId(id)
{
this.attachDebug();
this._id = id;
}
function getDebugId()
{
this.attachDebug();
return this._id;
}
function trace(traceobj)
{
var _loc1_ = this;
_loc1_.attachDebug();
if(_loc1_._config.m_debug && _loc1_._config.client.m_debug && _loc1_._config.client.trace)
{
_loc1_.sendDebugEvent(new mx.remoting.debug.events.NetDebugTrace(traceobj));
}
}
function getDebugConfig()
{
this.attachDebug();
return this._config;
}
function getNetDebug()
{
return mx.remoting.debug.NetDebug.getNetDebug();
}
}