Class HttpServer2.Builder

java.lang.Object
org.apache.hadoop.http.HttpServer2.Builder
Enclosing class:
HttpServer2

public static class HttpServer2.Builder extends Object
Class to construct instances of HTTP server with specific options.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setName

      public HttpServer2.Builder setName(String name)
    • addEndpoint

      public HttpServer2.Builder addEndpoint(URI endpoint)
      Add an endpoint that the HTTP server should listen to.
      Parameters:
      endpoint - the endpoint of that the HTTP server should listen to. The scheme specifies the protocol (i.e. HTTP / HTTPS), the host specifies the binding address, and the port specifies the listening port. Unspecified or zero port means that the server can listen to any port.
      Returns:
      Builder.
    • hostName

      public HttpServer2.Builder hostName(String hostName)
      Set the hostname of the http server. The host name is used to resolve the _HOST field in Kerberos principals. The hostname of the first listener will be used if the name is unspecified.
      Parameters:
      hostName - hostName.
      Returns:
      Builder.
    • trustStore

      public HttpServer2.Builder trustStore(String location, String password, String type)
    • keyStore

      public HttpServer2.Builder keyStore(String location, String password, String type)
    • keyPassword

      public HttpServer2.Builder keyPassword(String password)
    • needsClientAuth

      public HttpServer2.Builder needsClientAuth(boolean value)
      Specify whether the server should authorize the client in SSL connections.
      Parameters:
      value - value.
      Returns:
      Builder.
    • setFindPort

      public HttpServer2.Builder setFindPort(boolean findPort)
    • setPortRanges

      public HttpServer2.Builder setPortRanges(Configuration.IntegerRanges ranges)
    • setConf

      public HttpServer2.Builder setConf(Configuration conf)
    • setSSLConf

      public HttpServer2.Builder setSSLConf(Configuration sslCnf)
      Specify the SSL configuration to load. This API provides an alternative to keyStore/keyPassword/trustStore.
      Parameters:
      sslCnf - sslCnf.
      Returns:
      Builder.
    • setPathSpec

      public HttpServer2.Builder setPathSpec(String[] pathSpec)
    • setACL

    • setSecurityEnabled

      public HttpServer2.Builder setSecurityEnabled(boolean securityEnabled)
    • setUsernameConfKey

      public HttpServer2.Builder setUsernameConfKey(String usernameConfKey)
    • setKeytabConfKey

      public HttpServer2.Builder setKeytabConfKey(String keytabConfKey)
    • disallowFallbackToRandomSingerSecretProvider

      public HttpServer2.Builder disallowFallbackToRandomSingerSecretProvider(boolean value)
    • setAuthFilterConfigurationPrefix

      public HttpServer2.Builder setAuthFilterConfigurationPrefix(String value)
    • setAuthFilterConfigurationPrefixes

      public HttpServer2.Builder setAuthFilterConfigurationPrefixes(String[] prefixes)
    • excludeCiphers

      public HttpServer2.Builder excludeCiphers(String pExcludeCiphers)
    • includeCiphers

      public HttpServer2.Builder includeCiphers(String pIncludeCiphers)
    • configureXFrame

      public HttpServer2.Builder configureXFrame(boolean xFrameEnabled)
      Adds the ability to control X_FRAME_OPTIONS on HttpServer2.
      Parameters:
      xFrameEnabled - - True enables X_FRAME_OPTIONS false disables it.
      Returns:
      Builder.
    • setXFrameOption

      public HttpServer2.Builder setXFrameOption(String option)
      Sets a valid X-Frame-option that can be used by HttpServer2.
      Parameters:
      option - - String DENY, SAMEORIGIN or ALLOW-FROM are the only valid options. Any other value will throw IllegalArgument Exception.
      Returns:
      Builder.
    • setSniHostCheckEnabled

      public HttpServer2.Builder setSniHostCheckEnabled(boolean sniHostCheckEnabled)
      Enable or disable sniHostCheck.
      Parameters:
      sniHostCheckEnabled - Enable sniHostCheck if true, else disable it.
      Returns:
      Builder.
    • build

      public HttpServer2 build() throws IOException
      Throws:
      IOException