Lines Matching full:this

4  * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
7 * "License"); you may not use this file except in compliance
32 * This library creates one global object: Thrift
33 * Code in this library must never create additional global identifiers,
145 this.message = message;
155 return this.message;
196 this.message = message;
197 this.code = typeof code === 'number' ? code : 0;
219 this.message = ret.value;
227 this.code = ret.value;
250 if (this.message) {
252 output.writeString(this.getMessage());
256 if (this.code) {
258 output.writeI32(this.code);
272 return this.code;
286 Error.call(this);
288 Error.captureStackTrace(this, this.constructor);
290 this.name = this.constructor.name;
291 this.type = type;
292 this.message = message;
299 * your own. This type can also be constructed using the Transport alias
311 this.url = url;
312 this.wpos = 0;
313 this.rpos = 0;
314 this.useCORS = (options && options.useCORS);
315 this.customHeaders = options ? (options.customHeaders ? options.customHeaders : {}): {};
316 this.send_buf = '';
317 this.recv_buf = '';
344 var self = this;
345 if ((async && !callback) || this.url === undefined || this.url === '') {
346 return this.send_buf;
349 var xreq = this.getXmlHttpRequestObject();
362 if (this.readyState == 4 && this.status == 200) {
363 self.setRecvBuffer(this.responseText);
380 xreq.open('POST', this.url, !!async);
392 xreq.send(this.send_buf);
405 this.recv_buf = xreq.responseText;
406 this.recv_buf_sz = this.recv_buf.length;
407 this.wpos = this.recv_buf.length;
408 this.rpos = 0;
426 var thriftTransport = this;
429 url: this.url,
459 this.recv_buf = buf;
460 this.recv_buf_sz = this.recv_buf.length;
461 this.wpos = this.recv_buf.length;
462 this.rpos = 0;
475 * Opens the transport connection, with XHR this is a nop.
480 * Closes the transport connection, with XHR this is a nop.
491 var avail = this.wpos - this.rpos;
503 var ret = this.read_buf.substr(this.rpos, give);
504 this.rpos += give;
515 return this.recv_buf;
523 this.send_buf = buf;
532 return this.send_buf;
550 this.__reset(url);
555 this.url = url; //Where to connect
556 this.socket = null; //The web socket
557 this.callbacks = []; //Pending callbacks
558 this.send_pending = []; //Buffers/Callback pairs waiting to be sent
559 this.send_buf = ''; //Outbound data, immutable until sent
560 this.recv_buf = ''; //Inbound data
561 this.rb_wpos = 0; //Network write position in receive buffer
562 this.rb_rpos = 0; //Client read position in receive buffer
574 var self = this;
575 if (this.isOpen()) {
577 this.socket.send(this.send_buf);
578 this.callbacks.push((function() {
589 this.send_pending.push({
590 buf: this.send_buf,
597 var self = this;
598 if (this.send_pending.length > 0) {
601 this.send_pending.forEach(function(elem) {
611 this.send_pending = [];
616 this.__reset(this.url);
620 if (this.callbacks.length) {
621 this.callbacks.shift()(evt.data);
627 this.socket.close();
635 this.recv_buf = buf;
636 this.recv_buf_sz = this.recv_buf.length;
637 this.wpos = this.recv_buf.length;
638 this.rpos = 0;
647 return this.socket && this.socket.readyState == this.socket.OPEN;
655 if (this.socket && this.socket.readyState != this.socket.CLOSED) {
659 this.socket = new WebSocket(this.url);
660 this.socket.onopen = this.__onOpen.bind(this);
661 this.socket.onmessage = this.__onMessage.bind(this);
662 this.socket.onerror = this.__onError.bind(this);
663 this.socket.onclose = this.__onClose.bind(this);
670 this.socket.close();
680 var avail = this.wpos - this.rpos;
692 var ret = this.read_buf.substr(this.rpos, give);
693 this.rpos += give;
704 return this.recv_buf;
712 this.send_buf = buf;
721 return this.send_buf;
737 this.tstack = [];
738 this.tpos = [];
739 this.transport = transport;
793 return this.transport;
800 * @param {number} seqid - The sequence number of this call (always 0 in Apache Thrift).
803 this.tstack = [];
804 this.tpos = [];
806 this.tstack.push([Thrift.Protocol.Version, '"' +
814 var obj = this.tstack.pop();
816 this.wobj = this.tstack.pop();
817 this.wobj.push(obj);
819 this.wbuf = '[' + this.wobj.join(',') + ']';
821 this.transport.write(this.wbuf);
830 this.tpos.push(this.tstack.length);
831 this.tstack.push({});
839 var p = this.tpos.pop();
840 var struct = this.tstack[p];
854 this.tstack[p] = str;
864 this.tpos.push(this.tstack.length);
865 this.tstack.push({ 'fieldId': '"' +
875 var value = this.tstack.pop();
876 var fieldInfo = this.tstack.pop();
878 this.tstack[this.tstack.length - 1][fieldInfo.fieldId] = '{' +
880 this.tpos.pop();
897 this.tpos.push(this.tstack.length);
898 this.tstack.push([Thrift.Protocol.Type[keyType],
906 var p = this.tpos.pop();
908 if (p == this.tstack.length) {
912 if ((this.tstack.length - p - 1) % 2 !== 0) {
913 this.tstack.push('');
916 var size = (this.tstack.length - p - 1) / 2;
918 this.tstack[p][this.tstack[p].length - 1] = size;
922 while (this.tstack.length > p + 1) {
923 var v = this.tstack.pop();
924 var k = this.tstack.pop();
936 this.tstack[p].push(map);
937 this.tstack[p] = '[' + this.tstack[p].join(',') + ']';
946 this.tpos.push(this.tstack.length);
947 this.tstack.push([Thrift.Protocol.Type[elemType], size]);
954 var p = this.tpos.pop();
956 while (this.tstack.length > p + 1) {
957 var tmpVal = this.tstack[p + 1];
958 this.tstack.splice(p + 1, 1);
959 this.tstack[p].push(tmpVal);
962 this.tstack[p] = '[' + this.tstack[p].join(',') + ']';
971 this.tpos.push(this.tstack.length);
972 this.tstack.push([Thrift.Protocol.Type[elemType], size]);
979 var p = this.tpos.pop();
981 while (this.tstack.length > p + 1) {
982 var tmpVal = this.tstack[p + 1];
983 this.tstack.splice(p + 1, 1);
984 this.tstack[p].push(tmpVal);
987 this.tstack[p] = '[' + this.tstack[p].join(',') + ']';
992 this.tstack.push(value ? 1 : 0);
997 this.tstack.push(i8);
1002 this.tstack.push(i16);
1007 this.tstack.push(i32);
1013 this.tstack.push(i64);
1015 this.tstack.push(Int64Util.toDecimalString(i64));
1021 this.tstack.push(dbl);
1028 this.tstack.push(null);
1052 this.tstack.push('"' + escapedString + '"');
1069 this.tstack.push('"' + btoa(str) + '"');
1084 this.rstack = [];
1085 this.rpos = [];
1087 received = this.transport.readAll();
1090 this.robj = JSONInt64.parse(received);
1092 this.robj = JSON.parse(received);
1094 this.robj = jQuery.parseJSON(received);
1096 this.robj = eval(received);
1100 var version = this.robj.shift();
1106 r.fname = this.robj.shift();
1107 r.mtype = this.robj.shift();
1108 r.rseqid = this.robj.shift();
1112 this.rstack.push(this.robj.shift());
1130 //incase this is an array of structs
1131 if (this.rstack[this.rstack.length - 1] instanceof Array) {
1132 this.rstack.push(this.rstack[this.rstack.length - 1].shift());
1140 if (this.rstack[this.rstack.length - 2] instanceof Array) {
1141 this.rstack.pop();
1163 for (var f in (this.rstack[this.rstack.length - 1])) {
1169 this.rpos.push(this.rstack.length);
1171 var field = this.rstack[this.rstack.length - 1][fid];
1174 delete this.rstack[this.rstack.length - 1][fid];
1176 this.rstack.push(field);
1183 //should only be 1 of these but this is the only
1185 for (var i in (this.rstack[this.rstack.length - 1])) {
1191 this.rstack[this.rstack.length - 1] =
1192 this.rstack[this.rstack.length - 1][i];
1205 var pos = this.rpos.pop();
1208 while (this.rstack.length > pos) {
1209 this.rstack.pop();
1226 var map = this.rstack.pop();
1229 this.rstack.push(map);
1239 this.rpos.push(this.rstack.length);
1240 this.rstack.push(map.shift());
1247 this.readFieldEnd();
1261 var list = this.rstack[this.rstack.length - 1];
1267 this.rpos.push(this.rstack.length);
1268 this.rstack.push(list.shift());
1275 var pos = this.rpos.pop() - 2;
1276 var st = this.rstack;
1288 return this.readListBegin(elemType, size);
1293 return this.readListEnd();
1300 var r = this.readI32();
1314 return this.readI32();
1320 return this.readI32();
1327 f = this.rstack[this.rstack.length - 1];
1347 this.rstack.push(f[i]);
1355 this.rstack.pop();
1365 f = this.rstack[this.rstack.length - 1];
1399 this.rstack.push(f[i]);
1408 this.rstack.pop();
1416 return this.readI32();
1422 var r = this.readI32();
1429 var r = this.readI32();
1440 return this.readBool();
1443 return this.readByte();
1446 return this.readI16();
1449 return this.readI32();
1452 return this.readI64();
1455 return this.readDouble();
1458 return this.readString();
1461 this.readStructBegin();
1463 ret = this.readFieldBegin();
1467 this.skip(ret.ftype);
1468 this.readFieldEnd();
1470 this.readStructEnd();
1474 ret = this.readMapBegin();
1477 if (this.rstack.length > this.rpos[this.rpos.length - 1] + 1) {
1478 this.rstack.pop();
1481 this.skip(ret.ktype);
1482 this.skip(ret.vtype);
1484 this.readMapEnd();
1488 ret = this.readSetBegin();
1490 this.skip(ret.etype);
1492 this.readSetEnd();
1496 ret = this.readListBegin();
1498 this.skip(ret.etype);
1500 this.readListEnd();
1515 Thrift.Protocol.call(this, trans, strictRead, strictWrite);
1516 this.serviceName = srvName;
1524 …Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ':' + name, type, seqid); argument
1526 Thrift.Protocol.prototype.writeMessageBegin.call(this, name, type, seqid); argument
1531 this.seqid = 0;
1549 var self = this;