org.mashupbots.socko.webserver

WebServerConfig

case class WebServerConfig(serverName: String, hostname: String, port: Int, webLog: Option[WebLogConfig], ssl: Option[SslConfig], http: HttpConfig, tcp: TcpConfig) extends Extension with Product with Serializable

Web server configuration

The configuration can be optionally loaded from Akka's application.conf file.

The following example configuration file:

  akka-config-example {
    server-name=AkkaConfigExample
    hostname=localhost
    port=9000

    # Optional web log. If not supplied, web server activity logging is turned off.
    web-log {

      # Optional path of actor to which web log events will be sent for writing. If not specified, the default
      # web log writer will be created
      custom-actor-path = "akka://my-system/user/web-log-writer"

      # Optional web log format for the default web log writer: Common, Combined or Extended.
      # If no specified, Common is the default.
      format = Common
    }

    # Optional SSL. If not supplied, ssl is turned off.
    ssl {

      # Path to key store (server cert.)
      key-store-file=/tmp/ks.dat

      # Password to key store
      key-store-password=kspwd

      # Optional path to trust store (client cert.)
      trust-store-file=/tmp/ts.dat

      # Optional password to trust store
      trust-store-password=tspwd
    }

    # Optional HTTP protocol configuration. If not supplied, defaults are used.
    http {

      # Maximum size of HTTP request. Defaults to 4MB.
      max-length-in-mb=4

      # Maximum length of the HTTP initial line. Defaults to 4096 bytes (4K).
      max-initial-line-length=4096

      # Maximum size of HTTP headers. Defaults to 8192 bytes (8K).
      max-header-size-in-bytes=8192

      # Maximum size of HTTP chunks. Defaults to 8192 bytes (8K).
      max-chunk-size-in-bytes=8192

      # Flag to indicate if HTTP chunk requests should be aggregated and presented
      # as a single HTTP request. Defaults to true.
      aggregate-chunks=true

      # Content under this size is not compressed. Defaults to 1024 bytes (1K).
      # Set to -1 to turn off compression; or 0 to compress all content.
      min-compressible-content-size-in-bytes=1024

      # Content over this size is not compressed. Defaults to 1MB
      max-compressible-content-size-in-bytes=60

      # Only content with the specified MIME type will be compressed
      compressible-content-types=[
        "text/plain", "text/html", "text/xml", "text/css",
        "application/xml", "application/xhtml+xml", "application/rss+xml",
        "application/json", "application/jsonml+json",
        "application/javascript", "application/x-javascript"]

      # Enable SPDY protocol or not. Defaults to `false`. If `true`, you must also enable SSL.
      spdy=false
    }

    # Optional TCP protocol configuration. If not supplied, defaults are used.
    tcp {

      # Disable Nagle's algorithm. Defaults to `true` if not supplied.
      no-delay=

      # Set a hint the size of the underlying buffers for outgoing network I/O.
      send-buffer-size=

      # Get the size of the buffer actually used by the platform when receiving in data on this socket
      receive-buffer-size=

      # Turn on socket keep-alive. `true` or `false`.
      keep-alive=

      # Enable reuse address for a socket and not throw an "already bind exception". `true` or `false`.
      reuse-address=

      # Specify a linger-on-close timeout.
      so-linger=

      # Sets the type-of-service or traffic class field in the IP header for a TCP or UDP socket.
      traffic-class=

      # The number of requests that can be queued.
      accept-backlog=
    }
  }

can be loaded as follows:

  object MyWebServerConfig extends ExtensionId[WebServerConfig] with ExtensionIdProvider {
    override def lookup = MyWebServerConfig
    override def createExtension(system: ExtendedActorSystem) =
      new WebServerConfig(system.settings.config, "akka-config-example")
  }

  val myWebServerConfig = MyWebServerConfig(actorSystem)
  val webServer = new WebServer(myWebServerConfig, routes)
  webServer.start()
serverName

Human friendly name of this server. Defaults to WebServer.

hostname

Hostname or IP address to bind. 0.0.0.0 will bind to all addresses. You can also specify comma separated hostnames/ip address like localhost,192.168.1.1. Defaults to localhost.

port

IP port number to bind to. Defaults to 8888.

webLog

Optional web log configuration. If None, web log events will NOT be generated.

ssl

SSL protocol configuration. If None, then SSL will not be turned on. Defaults to None.

http

HTTP protocol configuration. Defaults to an instance of HttpConfig with default settings.

tcp

TCP IP protocol configuration. Defaults to an instance of TcpConfig with default settings.

Linear Supertypes
Serializable, Serializable, Product, Equals, Extension, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. WebServerConfig
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Extension
  7. AnyRef
  8. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WebServerConfig(config: Config, prefix: String)

    Read configuration from AKKA's application.conf

  2. new WebServerConfig(serverName: String = "WebServer", hostname: String = "localhost", port: Int = 8888, webLog: Option[WebLogConfig] = scala.None, ssl: Option[SslConfig] = scala.None, http: HttpConfig = ..., tcp: TcpConfig = ...)

    serverName

    Human friendly name of this server. Defaults to WebServer.

    hostname

    Hostname or IP address to bind. 0.0.0.0 will bind to all addresses. You can also specify comma separated hostnames/ip address like localhost,192.168.1.1. Defaults to localhost.

    port

    IP port number to bind to. Defaults to 8888.

    webLog

    Optional web log configuration. If None, web log events will NOT be generated.

    ssl

    SSL protocol configuration. If None, then SSL will not be turned on. Defaults to None.

    http

    HTTP protocol configuration. Defaults to an instance of HttpConfig with default settings.

    tcp

    TCP IP protocol configuration. Defaults to an instance of TcpConfig with default settings.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def canEqual(arg0: Any): Boolean

    Definition Classes
    WebServerConfig → Equals
  8. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    WebServerConfig → Equals → AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    WebServerConfig → AnyRef → Any
  14. val hostname: String

    Hostname or IP address to bind.

    Hostname or IP address to bind. 0.0.0.0 will bind to all addresses. You can also specify comma separated hostnames/ip address like localhost,192.168.1.1. Defaults to localhost.

  15. val http: HttpConfig

    HTTP protocol configuration.

    HTTP protocol configuration. Defaults to an instance of HttpConfig with default settings.

  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. val port: Int

    IP port number to bind to.

    IP port number to bind to. Defaults to 8888.

  21. def productArity: Int

    Definition Classes
    WebServerConfig → Product
  22. def productElement(arg0: Int): Any

    Definition Classes
    WebServerConfig → Product
  23. def productIterator: Iterator[Any]

    Definition Classes
    Product
  24. def productPrefix: String

    Definition Classes
    WebServerConfig → Product
  25. val serverName: String

    Human friendly name of this server.

    Human friendly name of this server. Defaults to WebServer.

  26. val ssl: Option[SslConfig]

    SSL protocol configuration.

    SSL protocol configuration. If None, then SSL will not be turned on. Defaults to None.

  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  28. val tcp: TcpConfig

    TCP IP protocol configuration.

    TCP IP protocol configuration. Defaults to an instance of TcpConfig with default settings.

  29. def toString(): String

    Definition Classes
    WebServerConfig → AnyRef → Any
  30. def validate(): Unit

    Validate current configuration settings.

    Validate current configuration settings. Throws an exception if configuration has errors.

  31. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  32. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  33. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  34. val webLog: Option[WebLogConfig]

    Optional web log configuration.

    Optional web log configuration. If None, web log events will NOT be generated.

Deprecated Value Members

  1. def productElements: Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Extension

Inherited from AnyRef

Inherited from Any