[
https://issues.apache.org/jira/browse/CALCITE-2284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16460053#comment-16460053
]
ASF GitHub Bot commented on CALCITE-2284:
-----------------------------------------
Github user joshelser commented on a diff in the pull request:
https://github.com/apache/calcite-avatica/pull/46#discussion_r185312096
--- Diff:
server/src/main/java/org/apache/calcite/avatica/server/ServerCustomizer.java ---
@@ -0,0 +1,32 @@
+/*
+ * 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.calcite.avatica.server;
+
+import org.eclipse.jetty.server.Server;
+
+/**
+ * Callback for customizing a Jetty {@link Server}.
+ */
+public interface ServerCustomizer {
+ /**
+ * Customize the server during initialization.
+ * @param server The server to customize
+ */
+ void customize(Server server);
--- End diff --
I think this should be changed -- perhaps parameterize this class with the
concrete `Server` type. Avatica's API should not strictly depend on an
implementation details (in this case, that Jetty is being used). We don't want
users to know that Jetty is the webserver used behind the scenes.
e.g.
```java
public interface ServerCustomizer<T> {
void customize(T server);
}
```
Making this change would also require some changes to go into the
HttpServer.Builder class to make sure that users know exactly what they're
getting. I think deprecating `HttpServer` and making it `JettyHttpServer`
instead is the right avenue (or something along those lines).
Does that make sense?
> Allow Jetty Server to be customized before startup
> --------------------------------------------------
>
> Key: CALCITE-2284
> URL: https://issues.apache.org/jira/browse/CALCITE-2284
> Project: Calcite
> Issue Type: Improvement
> Components: avatica
> Affects Versions: 1.11.0
> Reporter: Alex Araujo
> Priority: Critical
> Attachments: CALCITE-2284.patch
>
>
> Avatica server options currently allow users to enable TLS with file based
> key stores. In order to support additional options (in memory keystores,
> dynamically loaded keys/certificates, etc.) Avatica should provide a callback
> to customize the embedded Jetty server before starting it up.
>
> This would be similar to how Spring Boot allows developers to customize the
> embedded server.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)