Class HttpServer

java.lang.Object
org.apache.calcite.avatica.server.HttpServer

public class HttpServer extends Object
Avatica HTTP server.

If you need to change the server's configuration, override the configureConnector(ServerConnector, int) method in a derived class.

  • Constructor Details

    • HttpServer

      @Deprecated public HttpServer(org.eclipse.jetty.server.Handler handler)
      Deprecated.
    • HttpServer

      public HttpServer(AvaticaHandler handler)
      Constructs an HttpServer which binds to an ephemeral port.
      Parameters:
      handler - The Handler to run
    • HttpServer

      @Deprecated public HttpServer(int port, org.eclipse.jetty.server.Handler handler)
      Deprecated.
    • HttpServer

      public HttpServer(int port, AvaticaHandler handler)
      Constructs an HttpServer with no additional configuration.
      Parameters:
      port - The listen port
      handler - The Handler to run
    • HttpServer

      public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config)
      Constructs an HttpServer.
      Parameters:
      port - The listen port
      handler - The Handler to run
      config - Optional configuration for the server
    • HttpServer

      public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config, Subject subject)
      Constructs an HttpServer.
      Parameters:
      port - The listen port
      handler - The Handler to run
      config - Optional configuration for the server
      subject - The javax.security Subject for the server, or null
    • HttpServer

      public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config, Subject subject, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslFactory)
      Constructs an HttpServer.
      Parameters:
      port - The listen port
      handler - The Handler to run
      config - Optional configuration for the server
      subject - The javax.security Subject for the server, or null
      sslFactory - A configured SslContextFactory.Server, or null
    • HttpServer

      public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config, Subject subject, org.eclipse.jetty.util.ssl.SslContextFactory.Server sslFactory, int maxAllowedHeaderSize)
      Constructs an HttpServer.
      Parameters:
      port - The listen port
      handler - The Handler to run
      config - Optional configuration for the server
      subject - The javax.security Subject for the server, or null
      sslFactory - A configured SslContextFactory.Server, or null
      maxAllowedHeaderSize - A maximum size in bytes that are allowed in an HTTP header
  • Method Details

    • start

      public void start()
    • internalStart

      protected void internalStart()
    • getServerConnector

      protected org.eclipse.jetty.server.ServerConnector getServerConnector()
    • configureSpnego

      protected org.eclipse.jetty.security.ConstraintSecurityHandler configureSpnego(org.eclipse.jetty.server.Server server, AvaticaServerConfiguration config)
      Configures the connector given the config for using SPNEGO.
      Parameters:
      config - The configuration
    • configureBasicAuthentication

      protected org.eclipse.jetty.security.ConstraintSecurityHandler configureBasicAuthentication(org.eclipse.jetty.server.Server server, AvaticaServerConfiguration config)
    • configureDigestAuthentication

      protected org.eclipse.jetty.security.ConstraintSecurityHandler configureDigestAuthentication(org.eclipse.jetty.server.Server server, AvaticaServerConfiguration config)
    • configureCommonAuthentication

      protected org.eclipse.jetty.security.ConstraintSecurityHandler configureCommonAuthentication(String constraintName, String[] allowedRoles, org.eclipse.jetty.security.Authenticator authenticator, String realm, org.eclipse.jetty.security.LoginService loginService)
    • configureConnector

      protected org.eclipse.jetty.server.ServerConnector configureConnector(org.eclipse.jetty.server.ServerConnector connector, int port)
      Configures the server connector.

      The default configuration sets a timeout of 1 minute and disables TCP linger time.

      To change the configuration, override this method in a derived class. The overriding method must call its super method.

      Parameters:
      connector - connector to be configured
      port - port number handed over in constructor
    • getConfig

      protected AvaticaServerConfiguration getConfig()
    • stop

      public void stop()
    • join

      public void join() throws InterruptedException
      Throws:
      InterruptedException
    • getPort

      public int getPort()