⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 birtcommunicationmanager.js

📁 基于eclipse的birt报表!!! 是个web项目!
💻 JS
字号:
/******************************************************************************
 *	Copyright (c) 2004 Actuate Corporation and others.
 *	All rights reserved. This program and the accompanying materials 
 *	are made available under the terms of the Eclipse Public License v1.0
 *	which accompanies this distribution, and is available at
 *		http://www.eclipse.org/legal/epl-v10.html
 *	
 *	Contributors:
 *		Actuate Corporation - Initial implementation.
 *****************************************************************************/

/**
 *	BirtCommunicationManager
 *	...
 */
BirtCommunicationManager = Class.create( );

BirtCommunicationManager.prototype =
{
	__active : false,
	
	/**
	 *	Initialization routine required by "ProtoType" lib.
	 *
	 *	@return, void
	 */
	initialize: function( )
	{
	},

	/**
	 *	Make xml http request.
	 *
	 *	return, void
	 */
	connect: function( )
	{
		if(birtSoapRequest.__xml_document)
		{
			debug( birtSoapRequest.prettyPrintXML(birtSoapRequest.__xml_document), true);
		}
		
		if ( !birtSoapRequest.getURL( ) ) return;

		//activate delay message manager;
		this.__active = true;
		birtProgressBar.__start( );
		
		//workaround for Bugzilla Bug 144598. Add request header "Connection" as "keep-alive"
		var myAjax = new Ajax.Request( birtSoapRequest.getURL( ), { method: 'post', postBody: birtSoapRequest.__xml_document,
			onSuccess: this.responseHandler, onFailure: this.invalidResponseHandler,
			requestHeaders: ['Content-type', 'text/xml; charset=utf-8', 'SOAPAction', '""', 'request-type', 'SOAP', 'Connection', 'keep-alive' ] } );

		birtSoapRequest.reset( );
	},
	
	/**
	 *	Callback function triggered when reponse is ready, status is 200.
	 *
	 *	@request, httpXmlRequest instance
	 *	@return, void
	 */
	responseHandler: function( request )
	{
		debug(request.responseText, true);
		debug(birtSoapRequest.prettyPrintXML(request.responseXML.documentElement), true);
		
		if ( request.responseXML && request.responseXML.documentElement )
		{
			birtSoapResponse.process( request.responseXML.documentElement );
		}
		
		birtCommunicationManager.postProcess( );
		//todo handle responseText
	},
	
	/**
	 *	Callback function triggered when reponse is ready status is not 200.
	 *	Process any http (non-200) errors. Note this is not exception from
	 *	server side.
	 *
	 *	@request, httpXmlRequest instance
	 *	@return, void
	 */
	invalidResponseHandler: function( request )
	{
		debug("invalid response");
		
		if ( request.responseXML && request.responseXML.documentElement )
		{
			birtSoapResponse.process( request.responseXML.documentElement );
		}
		
		birtCommunicationManager.postProcess( );
	},

	/**
	 *	Post process after finish processing the response.
	 *
	 *	@return, void
	 */
	postProcess: function( )
	{
	    //deactivate delay message manager
		birtProgressBar.__stop( );
	    this.__active = false;
	}
}

var birtCommunicationManager = new BirtCommunicationManager( );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -