tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jorg...@apache.org
Subject [32/47] tinkerpop git commit: Support multiple mime types
Date Thu, 25 Jan 2018 11:01:30 GMT
Support multiple mime types


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b7f85ca5
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b7f85ca5
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b7f85ca5

Branch: refs/heads/master
Commit: b7f85ca5d167eac2443d7f5eb25423a8a7b4f6d4
Parents: 93cf86d
Author: Jorge Bay Gondra <jorgebaygondra@gmail.com>
Authored: Wed Nov 29 12:02:50 2017 +0100
Committer: Jorge Bay Gondra <jorgebaygondra@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100

----------------------------------------------------------------------
 .../lib/driver/driver-remote-connection.js           | 15 +++++++++------
 .../lib/driver/remote-connection.js                  |  2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b7f85ca5/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 31f27cd..51661c3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -29,8 +29,7 @@ var RemoteConnection = require('./remote-connection').RemoteConnection;
 var utils = require('../utils');
 var serializer = require('../structure/io/graph-serializer');
 var inherits = utils.inherits;
-var mimeType = 'application/vnd.gremlin-v2.0+json';
-var header = String.fromCharCode(mimeType.length) + mimeType;
+var defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 var responseStatusCode = {
   success: 200,
   noContent: 204,
@@ -41,16 +40,18 @@ var responseStatusCode = {
  * Creates a new instance of DriverRemoteConnection.
  * @param {String} url The resource uri.
  * @param {Object} [options] The connection options.
- * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
  * @param {Array} [options.ca] Trusted certificates.
  * @param {String|Array|Buffer} [options.cert] The certificate key.
+ * @param {String} [options.mimeType] The mime type to use.
  * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
- * @param {GraphSONReader} [options.reader] The GraphSON2 reader to use.
+ * @param {GraphSONReader} [options.reader] The reader to use.
  * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the
server certificate.
- * @param {GraphSONWriter} [options.writer] The GraphSON2 writer to use.
+ * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
+ * @param {GraphSONWriter} [options.writer] The writer to use.
  * @constructor
  */
 function DriverRemoteConnection(url, options) {
+  RemoteConnection.call(this, url);
   options = options || {};
   this._ws = new WebSocket(url, {
     ca: options.ca,
@@ -75,6 +76,8 @@ function DriverRemoteConnection(url, options) {
   this._openPromise = null;
   this._openCallback = null;
   this._closePromise = null;
+  var mimeType = options.mimeType || defaultMimeType;
+  this._header = String.fromCharCode(mimeType.length) + mimeType;
   this.isOpen = false;
   this.traversalSource = options.traversalSource || 'g';
 }
@@ -114,7 +117,7 @@ DriverRemoteConnection.prototype.submit = function (bytecode, promiseFactory)
{
         callback: callback,
         result: null
       };
-      var message = bufferFromString(header + JSON.stringify(self._getRequest(requestId,
bytecode)));
+      var message = bufferFromString(self._header + JSON.stringify(self._getRequest(requestId,
bytecode)));
       self._ws.send(message);
     });
   });

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b7f85ca5/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 8176c37..235375a 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -27,7 +27,7 @@ var TraversalStrategy = require('../process/traversal-strategy').TraversalStrate
 var utils = require('../utils');
 var inherits = utils.inherits;
 
-function RemoteConnection(url, traversalSource) {
+function RemoteConnection(url) {
   this.url = url;
 }
 


Mime
View raw message