You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2021/04/20 18:09:23 UTC

[GitHub] [tinkerpop] spmallette opened a new pull request #1419: TINKERPOP-2547 Add a way to supply a callback on requests with java driver

spmallette opened a new pull request #1419:
URL: https://github.com/apache/tinkerpop/pull/1419


   https://issues.apache.org/jira/browse/TINKERPOP-2547
   
   Added a `RequestInterceptor` interface that can be supplied to the `Cluster.Builder` which will act as a callback for request objects being made through the Java driver.
   
   All tests pass with `docker/build.sh -t -n -i`
   
   VOTE +1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tinkerpop] spmallette closed pull request #1419: TINKERPOP-2547 Add a way to supply a callback on handshake requests with java driver

Posted by GitBox <gi...@apache.org>.
spmallette closed pull request #1419:
URL: https://github.com/apache/tinkerpop/pull/1419


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tinkerpop] divijvaidya commented on a change in pull request #1419: TINKERPOP-2547 Add a way to supply a callback on requests with java driver

Posted by GitBox <gi...@apache.org>.
divijvaidya commented on a change in pull request #1419:
URL: https://github.com/apache/tinkerpop/pull/1419#discussion_r617516520



##########
File path: gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestInterceptor.java
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tinkerpop.gremlin.driver;
+
+import org.apache.tinkerpop.gremlin.driver.handler.RequestInterceptorHandler;
+
+import java.util.function.UnaryOperator;
+
+/**
+ * This function is called when the {@link RequestInterceptorHandler} encounters an object passing through it.
+ * Implementers will need to detect the type of object to determine if they will interact with it or not. Typically,
+ * objects will be a {@code FullHttpRequest} in the case of a websocket handshake or some form of

Review comment:
       To begin with, shall we only restrict this to exposing the HTTP Requests Object and only at the stage of first handshake initialization with the server (that would mean that instead of being a handler this callback will be called from the place where we construct the first HTTP request)? Suggesting because invoking a function for every frame when the actual interceptor is required only for modifying the initial set of headers will have unnecessary performance penalty. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tinkerpop] divijvaidya commented on pull request #1419: TINKERPOP-2547 Add a way to supply a callback on handshake requests with java driver

Posted by GitBox <gi...@apache.org>.
divijvaidya commented on pull request #1419:
URL: https://github.com/apache/tinkerpop/pull/1419#issuecomment-825039915


   Thank you for picking this up. 
   
   Vote +1 (assuming travis checks pass)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tinkerpop] spmallette commented on a change in pull request #1419: TINKERPOP-2547 Add a way to supply a callback on requests with java driver

Posted by GitBox <gi...@apache.org>.
spmallette commented on a change in pull request #1419:
URL: https://github.com/apache/tinkerpop/pull/1419#discussion_r617552165



##########
File path: gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestInterceptor.java
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tinkerpop.gremlin.driver;
+
+import org.apache.tinkerpop.gremlin.driver.handler.RequestInterceptorHandler;
+
+import java.util.function.UnaryOperator;
+
+/**
+ * This function is called when the {@link RequestInterceptorHandler} encounters an object passing through it.
+ * Implementers will need to detect the type of object to determine if they will interact with it or not. Typically,
+ * objects will be a {@code FullHttpRequest} in the case of a websocket handshake or some form of

Review comment:
       I was trying to generalize this functionality rather than pin it particularly to `FullHttpRequest` and the initial handshake. We could say that's not useful and that only the first HTTP request matters I guess. This feature was largely your idea so I'll modify it to work the way you'd envisioned.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org