var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="IRequestWriter.ts"/>
/// <reference path="../../base/BaseClass.ts"/>
/// <reference path="../../util/Json.ts"/>
var econda;
(function (econda) {
    var ajax;
    (function (ajax) {
        var writer;
        (function (writer) {
            /**
             * Encode request data as json string.
             *
             *     econda.Ajax.request({
             *         uri: 'http://www.econda.de',
             *         method: 'post',
             *         data: { myparam: 'myvalue' },
             *         writer: 'json'
             *     });
             *
             * @class econda.ajax.writer.JsonWriter
             */
            var JsonWriter = (function (_super) {
                __extends(JsonWriter, _super);
                function JsonWriter() {
                    _super.apply(this, arguments);
                    this._data = null;
                }
                JsonWriter.prototype.setData = function (data) {
                    this._data = data;
                    return this;
                };
                JsonWriter.prototype.getHeaders = function () {
                    return {
                        'Content-Type': 'application/json; charset=UTF-8'
                    };
                };
                JsonWriter.prototype.getBody = function () {
                    var arr = [], str;
                    str = econda.util.Json.stringify(this._data);
                    return str;
                };
                return JsonWriter;
            }(econda.base.BaseClass));
            writer.JsonWriter = JsonWriter; // end of class
        })(writer = ajax.writer || (ajax.writer = {}));
    })(ajax = econda.ajax || (econda.ajax = {}));
})(econda || (econda = {})); // end of module