<commit_before>////////////////////////////////////////////////////////////////////////////////
//
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2007 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

package mx.messaging.channels
{
    
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.events.StatusEvent;
import flash.utils.ByteArray;

import mx.core.mx_internal;
import mx.logging.Log;
import mx.messaging.FlexClient;
import mx.messaging.config.ConfigMap;
import mx.messaging.config.ServerConfig;
import mx.messaging.events.ChannelFaultEvent;
import mx.messaging.events.MessageEvent;
import mx.messaging.messages.AbstractMessage;
import mx.messaging.messages.AsyncMessage;
import mx.messaging.messages.ErrorMessage;
import mx.messaging.messages.IMessage;   
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
    
use namespace mx_internal;    
    
[ResourceBundle("messaging")]
    
/**
 *  The StreamingHTTPChannel class provides support for messaging and
 *  offers a different push model than the base HTTPChannel. Rather than
 *  polling for data from the server, the streaming channel opens an internal
 *  HTTP connection to the server that is held open to allow the server to
 *  stream data down to the client with no poll overhead.
 * 
 *  <p>
 *  Messages sent by this channel to the server are sent using a URLLoader
 *  which uses an HTTP connection internally for the duration of the operation.
 *  Once the message is sent and an acknowledgement or fault is returned the HTTP connection
 *  used by URLLoader is released by the channel. These client-to-server messages are 
 *  not sent over the streaming HTTP connection that the channel holds open to receive 
 *  server pushed data.
 *  </p>
 *  
 *  <p>
 *  Although this class extends the base HTTPChannel to inherit the regular HTTP
 *  handling, it does not support polling.
 *  </p>
 */    
public class StreamingHTTPChannel extends HTTPChannel
{    
    //--------------------------------------------------------------------------
    //
    // Constructor
    // 
    //--------------------------------------------------------------------------
    
    /**
     *  Creates an new StreamingHTTPChannel instance.
     *
	 *  @param id The id of this Channel.
	 *  
	 *  @param uri The uri for this Channel.
     */
    public function StreamingHTTPChannel(id:String = null, uri:String = null)
    {
        super(id, uri);

        // Disable polling.
        internalPollingEnabled = false;
    }    
 
    //--------------------------------------------------------------------------
    //
    // Variables
    // 
    //--------------------------------------------------------------------------
  
  	/**
  	 * Helper class used by the channel to establish a streaming HTTP connection
  	 * with the server.
  	 */
	private var streamingConnectionHandler:StreamingConnectionHandler;
	    
    /**
     *  @private
     */
    private var resourceManager:IResourceManager =
									ResourceManager.getInstance();
									       
    //--------------------------------------------------------------------------
    //
    // Properties
    // 
    //--------------------------------------------------------------------------

	//----------------------------------
	//  pollingEnabled
	//----------------------------------

    /**
     *  @private
     */
    override public function set pollingEnabled(value:Boolean):void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedHTTP");    	
        throw new Error(message);
    }
    
    //----------------------------------
	//  pollingInterval
	//----------------------------------
    
    /**
     *  @private
     */
    override public function set pollingInterval(value:Number):void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedHTTP");    	
        throw new Error(message);
    }
    
    //--------------------------------------------------------------------------
    //
    // Overridden Public Methods
    // 
    //--------------------------------------------------------------------------
	        
    /**
     *  Polling is not supported by this channel.
     */    
    override public function poll():void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedAMF");    	
        throw new Error(message);	    	
    }    
    
    //--------------------------------------------------------------------------
    //
    // Overriden Protected Methods
    // 
    //--------------------------------------------------------------------------

    /**
     *  @private
     *  Closes the streaming connection before redispatching the fault event. 
     * 
     *  @param event The ChannelFaultEvent.
     */
	override protected function connectFailed(event:ChannelFaultEvent):void
	{
		if (streamingConnectionHandler != null)
			streamingConnectionHandler.closeStreamingConnection();

        super.connectFailed(event);			 	    
	}<commit_msg>Transferred from the Adobe Open Source Subversion Repository<commit_after>////////////////////////////////////////////////////////////////////////////////
//
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2007 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

package mx.messaging.channels
{
    
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.events.StatusEvent;
import flash.utils.ByteArray;

import mx.core.mx_internal;
import mx.logging.Log;
import mx.messaging.FlexClient;
import mx.messaging.config.ConfigMap;
import mx.messaging.config.ServerConfig;
import mx.messaging.events.ChannelFaultEvent;
import mx.messaging.events.MessageEvent;
import mx.messaging.messages.AbstractMessage;
import mx.messaging.messages.AsyncMessage;
import mx.messaging.messages.ErrorMessage;
import mx.messaging.messages.IMessage;   
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
    
use namespace mx_internal;    
    
[ResourceBundle("messaging")]
    
/**
 *  The StreamingHTTPChannel class provides support for messaging and
 *  offers a different push model than the base HTTPChannel. Rather than
 *  polling for data from the server, the streaming channel opens an internal
 *  HTTP connection to the server that is held open to allow the server to
 *  stream data down to the client with no poll overhead.
 * 
 *  <p>
 *  Messages sent by this channel to the server are sent using a URLLoader
 *  which uses an HTTP connection internally for the duration of the operation.
 *  Once the message is sent and an acknowledgement or fault is returned the HTTP connection
 *  used by URLLoader is released by the channel. These client-to-server messages are 
 *  not sent over the streaming HTTP connection that the channel holds open to receive 
 *  server pushed data.
 *  </p>
 *  
 *  <p>
 *  Although this class extends the base HTTPChannel to inherit the regular HTTP
 *  handling, it does not support polling.
 *  </p>
 */    
public class StreamingHTTPChannel extends HTTPChannel
{    
    //--------------------------------------------------------------------------
    //
    // Constructor
    // 
    //--------------------------------------------------------------------------
    
    /**
     *  Creates an new StreamingHTTPChannel instance.
     *
	 *  @param id The id of this Channel.
	 *  
	 *  @param uri The uri for this Channel.
     */
    public function StreamingHTTPChannel(id:String = null, uri:String = null)
    {
        super(id, uri);

        // Disable polling.
        internalPollingEnabled = false;
    }    
 
    //--------------------------------------------------------------------------
    //
    // Variables
    // 
    //--------------------------------------------------------------------------
  
  	/**
  	 * Helper class used by the channel to establish a streaming HTTP connection
  	 * with the server.
  	 */
	private var streamingConnectionHandler:StreamingConnectionHandler;
	    
    /**
     *  @private
     */
    private var resourceManager:IResourceManager =
									ResourceManager.getInstance();
									       
    //--------------------------------------------------------------------------
    //
    // Properties
    // 
    //--------------------------------------------------------------------------

	//----------------------------------
	//  pollingEnabled
	//----------------------------------

    /**
     *  @private
     */
    override public function set pollingEnabled(value:Boolean):void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedHTTP");    	
        throw new Error(message);
    }
    
    //----------------------------------
	//  pollingInterval
	//----------------------------------
    
    /**
     *  @private
     */
    override public function set pollingInterval(value:Number):void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedHTTP");    	
        throw new Error(message);
    }
    
    //--------------------------------------------------------------------------
    //
    // Overridden Public Methods
    // 
    //--------------------------------------------------------------------------
	        
    /**
     *  Polling is not supported by this channel.
     */    
    override public function poll():void
    {
		var message:String = resourceManager.getString(
			"messaging", "pollingNotSupportedHTTP");    	
        throw new Error(message);	    	
    }    
    
    //--------------------------------------------------------------------------
    //
    // Overriden Protected Methods
    // 
    //--------------------------------------------------------------------------

    /**
     *  @private
     *  Closes the streaming connection before redispatching the fault event. 
     * 
     *  @param event The ChannelFaultEvent.
     */
	override protected function connectFailed(event:ChannelFaultEvent):void
	{
		if (streamingConnectionHandler != null)
			streamingConnectionHandler.closeStreamingConnection();

        super.connectFailed(event);			 	    
	}
{'fraction_non_alphanumeric': 0.25989324498435484, 'fraction_numerical': 0.0007362414872078042, 'mean_word_length': 1.385206321334504, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2771437', 'n_tokens_mistral': 2611, 'n_tokens_neox': 2466, 'n_words': 739}