Class HttpServerContextBuilder

java.lang.Object
org.refcodes.web.HttpServerContextBuilder
All Implemented Interfaces:
org.refcodes.io.MaxConnectionsAccessor, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty, org.refcodes.mixin.PortAccessor, org.refcodes.mixin.PortAccessor.PortBuilder<HttpServerContextBuilder>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.security.KeyStoreDescriptorAccessor, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, HttpServerContext, SchemeAccessor, SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty

public class HttpServerContextBuilder extends Object implements HttpServerContext, SchemeAccessor.SchemeProperty, SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.mixin.PortAccessor.PortBuilder<HttpServerContextBuilder>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>
The HttpServerContextBuilder implements the HttpServerContext interface extending it with builder functionality..
  • Field Details

    • DEFAULT_SCHEME

      public static final org.refcodes.data.Scheme DEFAULT_SCHEME
    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      See Also:
  • Constructor Details

    • HttpServerContextBuilder

      public HttpServerContextBuilder()
      Constructs a HttpClientContext with a default scheme Scheme.HTTP for port 8080.
    • HttpServerContextBuilder

      public HttpServerContextBuilder(int aPort)
      Constructs a HttpClientContext with a default scheme.
      Parameters:
      aPort - The TCP port to be used.
    • HttpServerContextBuilder

      public HttpServerContextBuilder(org.refcodes.data.Scheme aScheme, int aPort)
      Constructs a HttpClientContext with a default scheme.
      Parameters:
      aScheme - The Scheme (HTTP or HTTPS) to be used.
      aPort - The TCP port to be used.
    • HttpServerContextBuilder

      public HttpServerContextBuilder(String aProtocol, int aPort)
      Constructs a HttpClientContext with a default scheme.
      Parameters:
      aProtocol - The protocol such as the TransportLayerProtocol
      aPort - The TCP port to be used.
    • HttpServerContextBuilder

      public HttpServerContextBuilder(org.refcodes.data.Scheme aScheme, int aPort, org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections)
      Constructs a HttpClientContext with the given data.
      Parameters:
      aScheme - The Scheme (HTTP or HTTPS) to be used.
      aPort - The TCP port to be used.
      aKeyStoreDescriptor - The descriptor describing the keystore to be used.
      aMaxConnections - The maximum allowed open connections.
    • HttpServerContextBuilder

      public HttpServerContextBuilder(String aProtocol, int aPort, org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections)
      Constructs a HttpClientContext with the given data.
      Parameters:
      aProtocol - The protocol such as the TransportLayerProtocol elements.
      aPort - The TCP port to be used.
      aKeyStoreDescriptor - The descriptor describing the keystore to be used.
      aMaxConnections - The maximum allowed open connections.
  • Method Details

    • getKeyStoreDescriptor

      public org.refcodes.security.KeyStoreDescriptor getKeyStoreDescriptor()
      Specified by:
      getKeyStoreDescriptor in interface org.refcodes.security.KeyStoreDescriptorAccessor
    • getMaxConnections

      public int getMaxConnections()
      Specified by:
      getMaxConnections in interface org.refcodes.io.MaxConnectionsAccessor
    • getPort

      public int getPort()
      Specified by:
      getPort in interface org.refcodes.mixin.PortAccessor
    • getScheme

      public org.refcodes.data.Scheme getScheme()
      Retrieves the UrlScheme from the URL scheme.
      Specified by:
      getScheme in interface SchemeAccessor
      Returns:
      The UrlScheme stored by the URL scheme.
    • setKeyStoreDescriptor

      public void setKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor)
      Specified by:
      setKeyStoreDescriptor in interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
    • setMaxConnections

      public void setMaxConnections(int aMaxConnections)
      Specified by:
      setMaxConnections in interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
    • setPort

      public void setPort(int aPort)
      Specified by:
      setPort in interface org.refcodes.mixin.PortAccessor.PortMutator
    • setScheme

      public void setScheme(org.refcodes.data.Scheme aScheme)
      Sets the UrlScheme for the URL scheme.
      Specified by:
      setScheme in interface SchemeAccessor.SchemeMutator
      Parameters:
      aScheme - The UrlScheme to be stored by the URL scheme.
    • toProtocol

      public String toProtocol()
      Retrieves the protocol representation from the Scheme. In case of a scheme unknown by the Scheme enumeration, then SchemeAccessor.getScheme() might return null whilst SchemeAccessor.toProtocol() still retrieves the unknown scheme's protocol representation (as of SchemeAccessor.SchemeMutator.setProtocol(String)).
      Specified by:
      toProtocol in interface SchemeAccessor
      Returns:
      The protocol representation for the URL.
    • setProtocol

      public void setProtocol(String aProtocol)
      Sets the protocol String representation for the scheme property. You must provide the scheme's specific part as well. In case of HTTP, provide "http://". In case your provided protocol is unknown by the Scheme enumeration, then the scheme property will not be set, though the SchemeAccessor.toProtocol() still returns your protocol.
      Specified by:
      setProtocol in interface SchemeAccessor.SchemeMutator
      Parameters:
      aProtocol - The UrlScheme's String representation to be stored by the URL scheme.
    • withKeyStoreDescriptor

      public HttpServerContextBuilder withKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor)
      Specified by:
      withKeyStoreDescriptor in interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>
    • withMaxConnections

      public HttpServerContextBuilder withMaxConnections(int aMaxConnections)
      Specified by:
      withMaxConnections in interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>
    • withPort

      public HttpServerContextBuilder withPort(int aPort)
      Specified by:
      withPort in interface org.refcodes.mixin.PortAccessor.PortBuilder<HttpServerContextBuilder>
    • withProtocol

      public HttpServerContextBuilder withProtocol(String aProtocol)
      Sets the protocol for the URL scheme.
      Specified by:
      withProtocol in interface SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>
      Parameters:
      aProtocol - The protocol to be stored by the URL scheme.
      Returns:
      The builder for applying multiple build operations.
    • withScheme

      public HttpServerContextBuilder withScheme(org.refcodes.data.Scheme aScheme)
      Sets the UrlScheme for the URL scheme.
      Specified by:
      withScheme in interface SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>
      Parameters:
      aScheme - The UrlScheme to be stored by the URL scheme.
      Returns:
      The builder for applying multiple build operations.