T - element typepublic static class HttpServer.Builder<T> extends Object
HttpServer.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
HttpServer |
build()
Builds the HttpServer instance from
this. |
org.eclipse.jetty.util.ssl.SslContextFactory.Server |
buildSSLContextFactory() |
static <T> HttpServer.Builder<T> |
newBuilder()
Creates a typed Builder for Server customization.
|
HttpServer.Builder<T> |
withAutomaticLogin(File keytab)
Sets a keytab to be used to perform a Kerberos login automatically (without the use of JAAS).
|
HttpServer.Builder<T> |
withBasicAuthentication(String properties,
String[] allowedRoles)
Configures the server to use HTTP Basic authentication.
|
HttpServer.Builder<T> |
withCustomAuthentication(AvaticaServerConfiguration config)
Configures the server to use CUSTOM authentication mechanism, which can allow users to
combine benefits of multiple auth methods.
|
HttpServer.Builder<T> |
withDigestAuthentication(String properties,
String[] allowedRoles)
Configures the server to use HTTP Digest authentication.
|
HttpServer.Builder<T> |
withHandler(AvaticaHandler handler)
Sets an
AvaticaHandler directly on the builder. |
HttpServer.Builder<T> |
withHandler(Service service,
Driver.Serialization serialization)
Sets the
Service and Driver.Serialization information necessary to construct
the appropriate AvaticaHandler. |
HttpServer.Builder<T> |
withImpersonation(DoAsRemoteUserCallback remoteUserCallback)
Sets a callback implementation to defer the logic on how to run an action as a given user and
if the action should be permitted for that user.
|
HttpServer.Builder<T> |
withMaxHeaderSize(int maxHeaderSize)
Configures the maximum size, in bytes, of an HTTP header that the server will read.
|
HttpServer.Builder<T> |
withMetricsConfiguration(MetricsSystemConfiguration<?> metricsConfig)
Sets the given configuration to enable metrics collection in the server.
|
HttpServer.Builder<T> |
withPort(int port) |
HttpServer.Builder<T> |
withRemoteUserExtractor(RemoteUserExtractor remoteUserExtractor)
Sets a callback implementation to defer the logic on how to use the right remoteUserExtractor
to extract remote user.
|
HttpServer.Builder<T> |
withServerCustomizers(List<ServerCustomizer<T>> serverCustomizers,
Class<T> clazz)
Adds customizers to configure a Server before startup.
|
HttpServer.Builder<T> |
withSpnego(String principal)
Configures the server to use SPNEGO authentication.
|
HttpServer.Builder<T> |
withSpnego(String principal,
String realm)
Configures the server to use SPNEGO authentication.
|
HttpServer.Builder<T> |
withSpnego(String principal,
String[] additionalAllowedRealms)
Deprecated.
Since 1.20.0, because
additionalAllowedRealms is no longer considered. |
HttpServer.Builder<T> |
withSpnego(String principal,
String realm,
String[] additionalAllowedRealms)
Deprecated.
since 1.20.0 because
additionalAllowedRealms is no longer considered. |
HttpServer.Builder<T> |
withTLS(File keystore,
String keystorePassword,
File truststore,
String truststorePassword)
Configures the server to use TLS for wire encryption.
|
HttpServer.Builder<T> |
withTLS(File keystore,
String keystorePassword,
File truststore,
String truststorePassword,
String keystoreType)
Configures the server to use TLS for wire encryption.
|
HttpServer.Builder<T> |
withTLS(File keystore,
String keystorePassword,
File truststore,
String truststorePassword,
String keyStoreType,
String[] includeProtocols,
String[] includeCipherSuites)
Configures the server to use TLS for wire encryption.
|
public static <T> HttpServer.Builder<T> newBuilder()
T - The type of HttpServerpublic HttpServer.Builder<T> withPort(int port)
public HttpServer.Builder<T> withHandler(Service service, Driver.Serialization serialization)
Service and Driver.Serialization information necessary to construct
the appropriate AvaticaHandler.service - The Avatica serviceserialization - The serialization methodthispublic HttpServer.Builder<T> withHandler(AvaticaHandler handler)
AvaticaHandler directly on the builder. Most users will not want to use
this method and should instead use #withHandler(Service, Serialization).handler - The handlerthispublic HttpServer.Builder<T> withMetricsConfiguration(MetricsSystemConfiguration<?> metricsConfig)
metricsConfig - Configuration object for metrics.thispublic HttpServer.Builder<T> withSpnego(String principal)
principal contains the Kerberos realm. Invoking this method overrides any
previous call which configures authentication.principal - A kerberos principal with the realm required.this@Deprecated public HttpServer.Builder<T> withSpnego(String principal, String[] additionalAllowedRealms)
additionalAllowedRealms is no longer considered.principal contains the Kerberos realm. Invoking this method overrides any
previous call which configures authentication. Invoking this method overrides any previous
call which configures authentication. By default, only principals from the server's realm are
permitted, but additional realms can be allowed using additionalAllowedRealms.principal - A kerberos principal with the realm required.additionalAllowedRealms - Any additional realms, other than the server's realm, which
should be allowed to authenticate against the server. Can be null.thispublic HttpServer.Builder<T> withSpnego(String principal, String realm)
java.security.auth.login.config system property) before
starting the HttpServer. Invoking this method overrides any previous call which
configures authentication.principal - The kerberos principalrealm - The kerberos realmthis@Deprecated public HttpServer.Builder<T> withSpnego(String principal, String realm, String[] additionalAllowedRealms)
additionalAllowedRealms is no longer considered.java.security.auth.login.config system property) before
starting the HttpServer. Invoking this method overrides any previous call which
configures authentication. By default, only principals from the server's realm are permitted,
but additional realms can be allowed using additionalAllowedRealms.principal - The kerberos principalrealm - The kerberos realmadditionalAllowedRealms - Any additional realms, other than the server's realm, which
should be allowed to authenticate against the server. Can be null.thispublic HttpServer.Builder<T> withAutomaticLogin(File keytab)
keytab - A KeyTab file for the server's login.thispublic HttpServer.Builder<T> withImpersonation(DoAsRemoteUserCallback remoteUserCallback)
remoteUserCallback - User-provided implementation of the callbackthispublic HttpServer.Builder<T> withRemoteUserExtractor(RemoteUserExtractor remoteUserExtractor)
remoteUserExtractor - User-provided remoteUserExtractorthispublic HttpServer.Builder<T> withBasicAuthentication(String properties, String[] allowedRoles)
properties must
be in a form consumable by Jetty. Invoking this method overrides any previous call which
configures authentication. This authentication is supplementary to the JDBC-provided user
authentication interfaces and should only be used when those interfaces are not used.properties - Location of a properties file parseable by Jetty which contains users and
passwords.allowedRoles - An array of allowed roles in the properties filethispublic HttpServer.Builder<T> withDigestAuthentication(String properties, String[] allowedRoles)
properties must
be in a form consumable by Jetty. Invoking this method overrides any previous call which
configures authentication. This authentication is supplementary to the JDBC-provided user
authentication interfaces and should only be used when those interfaces are not used.properties - Location of a properties file parseable by Jetty which contains users and
passwords.allowedRoles - An array of allowed roles in the properties filethispublic HttpServer.Builder<T> withCustomAuthentication(AvaticaServerConfiguration config)
CustomAuthHttpServerTest for
examples on how to use it.
Note: Default ServerConnectors and Handlers will NOT be used.
Customize them directly using instances ServerCustomizerconfig - AvaticaServerConfiguration implementation that configures various details
about the authentication mechanism for HttpServerthispublic HttpServer.Builder<T> withTLS(File keystore, String keystorePassword, File truststore, String truststorePassword)
keystore - The server's keystorekeystorePassword - The keystore's passwordtruststore - The truststore containing the key used to generate the server's keytruststorePassword - The truststore's passwordthispublic HttpServer.Builder<T> withTLS(File keystore, String keystorePassword, File truststore, String truststorePassword, String keystoreType)
keystore - The server's keystorekeystorePassword - The keystore's passwordtruststore - The truststore containing the key used to generate the server's keytruststorePassword - The truststore's passwordkeystoreType - The keystore's typethispublic HttpServer.Builder<T> withTLS(File keystore, String keystorePassword, File truststore, String truststorePassword, String keyStoreType, String[] includeProtocols, String[] includeCipherSuites)
keystore - The server's keystorekeystorePassword - The keystore's passwordtruststore - The truststore containing the key used to generate the server's keytruststorePassword - The truststore's passwordkeyStoreType - The keystore's typeincludeProtocols - Included TLS protocols, as expected by JettyincludeCipherSuites - Included cypher suites, as expected by Jettythispublic HttpServer.Builder<T> withServerCustomizers(List<ServerCustomizer<T>> serverCustomizers, Class<T> clazz)
serverCustomizers - The customizers to useclazz - The type of server to customizethispublic HttpServer.Builder<T> withMaxHeaderSize(int maxHeaderSize)
maxHeaderSize - Maximums HTTP header size in bytesthispublic HttpServer build()
this.public org.eclipse.jetty.util.ssl.SslContextFactory.Server buildSSLContextFactory()
Copyright © 2012-2025 Apache Software Foundation. All Rights Reserved.