[ 
https://issues.apache.org/jira/browse/TINKERPOP-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17637781#comment-17637781
 ] 

ASF GitHub Bot commented on TINKERPOP-2480:
-------------------------------------------

divijvaidya commented on code in PR #1838:
URL: https://github.com/apache/tinkerpop/pull/1838#discussion_r1030495233


##########
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/UserAgent.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.util;
+
+import org.apache.tinkerpop.gremlin.util.Gremlin;
+import javax.naming.NamingException;
+
+public class UserAgent {

Review Comment:
   I was thinking in the following direction:
   
   1. UserAgent.java is a model (POJO) that describes the UserAgent. It 
contains fields such as JavaVersion etc. along with the getter & setters. It 
contains methods "serializeToString" and "deserializeFromString". This model 
resides in a place which is common to all drivers, communication protocols and 
server. I would suggest placing it in 
https://github.com/apache/tinkerpop/tree/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver
 at same level as Host.java. This POJO/modelling for UserAgent would help us 
from code extensibility perspective in future if we want to add enums or 
constraints checks on values of user agent.
   
   2. Both HTTP and WebSocket will create this POJO using a static method in 
the above file, perhaps, UserAgent#Generate() 
   
   
   The goal of this structure is to ensure that code is extensible to HTTP in 
future and that individual methods could be unit tested easily. I don't have a 
strong opinion on this except for things such as WS_HANDSHAKE_USER_AGENT which 
should be made agnostic of WebSocket (the same could be used for HTTP).





> User agent for Gremlin drivers
> ------------------------------
>
>                 Key: TINKERPOP-2480
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2480
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: driver, server
>    Affects Versions: 3.4.8
>            Reporter: Divij Vaidya
>            Priority: Minor
>
> Currently, a server does not distinguish amongst the different types of 
> clients connecting to it. This issue is to add a new feature to add user 
> agent field in the HTTP and WebSocket request header which could be used to 
> identify the specific client from which the request was made.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to