<commit_before>/**
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

goog.provide('org_apache_flex_net_HTTPService');

goog.require('org_apache_flex_core_HTMLElementWrapper');
goog.require('org_apache_flex_net_HTTPHeader');



/**
 * @constructor
 * @extends {org_apache_flex_core_HTMLElementWrapper}
 */
org_apache_flex_net_HTTPService = function() {
  org_apache_flex_net_HTTPService.base(this, 'constructor');

  /**
   * @private
   * @type {?string}
   */
  this.url_ = null;

  /**
   * @private
   * @type {number}
   */
  this.status_ = -1;

  /**
   * @private
   * @type {string}
   */
  this.method_ = 'GET';

  /**
   * @private
   * @type {Array}
   */
  this.headers_ = null;

  /**
   * @private
   * @type {Array}
   */
  this.responseHeaders_ = null;

  /**
   * @private
   * @type {?string}
   */
  this.responseURL_ = null;

  /**
   * @private
   * @type {Array.<Object>}
   */
  this.mxmlBeads_ = null;

  /**
   * @private
   * @type {Array.<Object>}
   */
  this.beads_ = null;

  /**
   * @private
   * @type {number}
   */
  this.timeout_ = 0;

  /**
   * @private
   * @type {?string}
   */
  this.contentData_ = null;

  /**
   * @private
   * @type {string}
   */
  this.contentType_ = 'application/x-www-form-urlencoded';

  /**
   * @private
   * @type {?string}
   */
  this.id_ = null;

  //try { // (erikdebruin) 'desperate' attempt to bypass XDR security in IE < 10
  //  this.contentType_ = 'text/plain';
  //  this.element = new XDomainRequest();
  //} catch (e) {}

  this.element = new XMLHttpRequest();
};
goog.inherits(org_apache_flex_net_HTTPService,
    org_apache_flex_core_HTMLElementWrapper);


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
org_apache_flex_net_HTTPService.prototype.FLEXJS_CLASS_INFO =
    { names: [{ name: 'HTTPService',
                qName: 'org_apache_flex_net_HTTPService'}] };


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_GET = 'GET';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_POST = 'POST';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_PUT = 'PUT';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_DELETE = 'DELETE';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_COMPLETE = 'complete';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_IO_ERROR = 'ioError';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_HTTP_STATUS = 'httpStatus';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_HTTP_RESPONSE_STATUS = 'httpResponseStatus';


Object.defineProperties(org_apache_flex_net_HTTPService.prototype, {
    /** @expose */
    strand: {
        /** @this {org_apache_flex_net_HTTPService} */
        set: function(value) {}
    },
    /** @expose */
    beads: {
        /** @this {org_apache_flex_net_HTTPService} */
        set: function(value) {
            this.mxmlBeads_ = value;
        }
    },
    /** @expose */
    data: {
        /** @this {org_apache_flex_net_HTTPService} */
        get: function() {
            return this.element.responseText;
        }
    },
    /** @expose */
    json: {
        /** @this {org_apache_flex_net_HTTPService} */
        get: function() {
            if (!this._json)
              _json = JSON.parse(this.data);
            return _json;
        }
    },<commit_msg>forgot 'this'<commit_after>/**
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

goog.provide('org_apache_flex_net_HTTPService');

goog.require('org_apache_flex_core_HTMLElementWrapper');
goog.require('org_apache_flex_net_HTTPHeader');



/**
 * @constructor
 * @extends {org_apache_flex_core_HTMLElementWrapper}
 */
org_apache_flex_net_HTTPService = function() {
  org_apache_flex_net_HTTPService.base(this, 'constructor');

  /**
   * @private
   * @type {?string}
   */
  this.url_ = null;

  /**
   * @private
   * @type {number}
   */
  this.status_ = -1;

  /**
   * @private
   * @type {string}
   */
  this.method_ = 'GET';

  /**
   * @private
   * @type {Array}
   */
  this.headers_ = null;

  /**
   * @private
   * @type {Array}
   */
  this.responseHeaders_ = null;

  /**
   * @private
   * @type {?string}
   */
  this.responseURL_ = null;

  /**
   * @private
   * @type {Array.<Object>}
   */
  this.mxmlBeads_ = null;

  /**
   * @private
   * @type {Array.<Object>}
   */
  this.beads_ = null;

  /**
   * @private
   * @type {number}
   */
  this.timeout_ = 0;

  /**
   * @private
   * @type {?string}
   */
  this.contentData_ = null;

  /**
   * @private
   * @type {string}
   */
  this.contentType_ = 'application/x-www-form-urlencoded';

  /**
   * @private
   * @type {?string}
   */
  this.id_ = null;

  //try { // (erikdebruin) 'desperate' attempt to bypass XDR security in IE < 10
  //  this.contentType_ = 'text/plain';
  //  this.element = new XDomainRequest();
  //} catch (e) {}

  this.element = new XMLHttpRequest();
};
goog.inherits(org_apache_flex_net_HTTPService,
    org_apache_flex_core_HTMLElementWrapper);


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
org_apache_flex_net_HTTPService.prototype.FLEXJS_CLASS_INFO =
    { names: [{ name: 'HTTPService',
                qName: 'org_apache_flex_net_HTTPService'}] };


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_GET = 'GET';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_POST = 'POST';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_PUT = 'PUT';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.HTTP_METHOD_DELETE = 'DELETE';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_COMPLETE = 'complete';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_IO_ERROR = 'ioError';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_HTTP_STATUS = 'httpStatus';


/**
 * @expose
 * @type {string}
 */
org_apache_flex_net_HTTPService.EVENT_HTTP_RESPONSE_STATUS = 'httpResponseStatus';


Object.defineProperties(org_apache_flex_net_HTTPService.prototype, {
    /** @expose */
    strand: {
        /** @this {org_apache_flex_net_HTTPService} */
        set: function(value) {}
    },
    /** @expose */
    beads: {
        /** @this {org_apache_flex_net_HTTPService} */
        set: function(value) {
            this.mxmlBeads_ = value;
        }
    },
    /** @expose */
    data: {
        /** @this {org_apache_flex_net_HTTPService} */
        get: function() {
            return this.element.responseText;
        }
    },
    /** @expose */
    json: {
        /** @this {org_apache_flex_net_HTTPService} */
        get: function() {
            if (!this._json)
              this._json = JSON.parse(this.data);
            return this._json;
        }
    },
{'fraction_non_alphanumeric': 0.14902157551430004, 'fraction_numerical': 0.002007024586051179, 'mean_word_length': 2.8331730769230767, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '3316795', 'n_tokens_mistral': 2819, 'n_tokens_neox': 2786, 'n_words': 515}