org.mashupbots.socko.handlers

StaticContentHandlerConfig

case class StaticContentHandlerConfig(rootFilePaths: Seq[String] = immutable.this.Nil, tempDir: File = ..., cache: LocalCache = ..., serverCacheMaxFileSize: Int = 1024.*(100), serverCacheTimeoutSeconds: Int = 3600, browserCacheTimeoutSeconds: Int = 3600) extends Extension with Product with Serializable

Configuration for org.mashupbots.socko.handlers.StaticContentHandler.

This can also be loaded from an externalized AKKA configuration file. For example:

static-content-config {
# CSV list of root paths from while files can be served.
root-file-paths=/home/me/path1,/home/me/path2

# Temporary directory where compressed files can be stored.
# Defaults to the `java.io.tmpdir` system property if setting is omitted
temp-dir=localhost

# Max number of files and resources to store in the local in memory cache
# Defaults to storing 1000 items if setting is omitted
server-cache-max-size=1000

# Maximum size of files (in bytes) to be cached. Files larger than this will
# not be cached and will be served from the file system or resorce.
# Defaults to 100K if setting is omitted
server-cache-max-file-size=102400

# Number of seconds files will be cached in local memory
# Defaults to 3600 if setting is omitted
server-cache-timeout=3600

# Number of seconds before a browser should check back with the server if a file has been updated.
# This setting is used to drive the `Expires` and `Cache-Control` HTTP headers.
# Defaults to 3600 if setting is omitted
browser-cache-timeout=3600
}

can be loaded as follows:

object MyStaticContentHandlerConfig extends ExtensionId[StaticContentHandlerConfig] with ExtensionIdProvider {
  override def lookup = MyStaticContentHandlerConfig
  override def createExtension(system: ExtendedActorSystem) =
    new StaticContentHandlerConfig(system.settings.config, "static-content-config")
}

val myStaticContentHandlerConfig = MyStaticContentHandlerConfig(actorSystem)
rootFilePaths

List of root paths from while files can be served. This is enforced to stop relative path type attacks; e.g. ../etc/passwd

tempDir

Temporary directory where compressed files can be stored. Defaults to the java.io.tmpdir system property.

cache

Local in memory cache to store file meta and content. Defaults to storing 1000 items.

serverCacheMaxFileSize

Maximum size of file contents to cache in memory The contents of files under this limit is cached in memory for serverCacheTimeoutSeconds. Requests for this file will be served by the contents stored in memory rather than the file system.

Files larger than this limit are served by reading from the file system for every request.

Defaults to 100K. 0 indicates that files will not be cached in memory.

serverCacheTimeoutSeconds

Number of seconds file meta data (such as file name, size, timestamp and hash) and file contents will be cached in memory. After this time, cache data will be removed and file meta data will and contents will have to be read from the file system.

Note that if serverCacheMaxFileSize is 0 and serverCacheTimeoutSeconds is > 0, then only file meta data will be cached in memory.

Defaults to 1 hour. 0 means files will NOT be cached.

browserCacheTimeoutSeconds

Number of seconds before a browser should check back with the server if a file has been updated.

This setting is used to drive the Expires and Cache-Control HTTP headers.

Defaults to 1 hour. 0 means cache headers will not be sent to the browser.

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

Instance Constructors

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

    Read configuration from AKKA's application.conf

  2. new StaticContentHandlerConfig(rootFilePaths: Seq[String] = immutable.this.Nil, tempDir: File = ..., cache: LocalCache = ..., serverCacheMaxFileSize: Int = 1024.*(100), serverCacheTimeoutSeconds: Int = 3600, browserCacheTimeoutSeconds: Int = 3600)

    rootFilePaths

    List of root paths from while files can be served. This is enforced to stop relative path type attacks; e.g. ../etc/passwd

    tempDir

    Temporary directory where compressed files can be stored. Defaults to the java.io.tmpdir system property.

    cache

    Local in memory cache to store file meta and content. Defaults to storing 1000 items.

    serverCacheMaxFileSize

    Maximum size of file contents to cache in memory The contents of files under this limit is cached in memory for serverCacheTimeoutSeconds. Requests for this file will be served by the contents stored in memory rather than the file system.

    Files larger than this limit are served by reading from the file system for every request.

    Defaults to 100K. 0 indicates that files will not be cached in memory.

    serverCacheTimeoutSeconds

    Number of seconds file meta data (such as file name, size, timestamp and hash) and file contents will be cached in memory. After this time, cache data will be removed and file meta data will and contents will have to be read from the file system.

    Note that if serverCacheMaxFileSize is 0 and serverCacheTimeoutSeconds is > 0, then only file meta data will be cached in memory.

    Defaults to 1 hour. 0 means files will NOT be cached.

    browserCacheTimeoutSeconds

    Number of seconds before a browser should check back with the server if a file has been updated.

    This setting is used to drive the Expires and Cache-Control HTTP headers.

    Defaults to 1 hour. 0 means cache headers will not be sent to the browser.

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. val browserCacheTimeoutSeconds: Int

    Number of seconds before a browser should check back with the server if a file has been updated.

    Number of seconds before a browser should check back with the server if a file has been updated.

    This setting is used to drive the Expires and Cache-Control HTTP headers.

    Defaults to 1 hour. 0 means cache headers will not be sent to the browser.

  8. val cache: LocalCache

    Local in memory cache to store file meta and content.

    Local in memory cache to store file meta and content. Defaults to storing 1000 items.

  9. def clone(): AnyRef

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

    Definition Classes
    AnyRef
  11. def finalize(): Unit

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

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

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

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

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

    Definition Classes
    AnyRef
  17. val rootFilePaths: Seq[String]

    List of root paths from while files can be served.

    List of root paths from while files can be served. This is enforced to stop relative path type attacks; e.g. ../etc/passwd

  18. val serverCacheMaxFileSize: Int

    Maximum size of file contents to cache in memory The contents of files under this limit is cached in memory for serverCacheTimeoutSeconds.

    Maximum size of file contents to cache in memory The contents of files under this limit is cached in memory for serverCacheTimeoutSeconds. Requests for this file will be served by the contents stored in memory rather than the file system.

    Files larger than this limit are served by reading from the file system for every request.

    Defaults to 100K. 0 indicates that files will not be cached in memory.

  19. val serverCacheTimeoutSeconds: Int

    Number of seconds file meta data (such as file name, size, timestamp and hash) and file contents will be cached in memory.

    Number of seconds file meta data (such as file name, size, timestamp and hash) and file contents will be cached in memory. After this time, cache data will be removed and file meta data will and contents will have to be read from the file system.

    Note that if serverCacheMaxFileSize is 0 and serverCacheTimeoutSeconds is > 0, then only file meta data will be cached in memory.

    Defaults to 1 hour. 0 means files will NOT be cached.

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

    Definition Classes
    AnyRef
  21. val tempDir: File

    Temporary directory where compressed files can be stored.

    Temporary directory where compressed files can be stored. Defaults to the java.io.tmpdir system property.

  22. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Extension

Inherited from AnyRef

Inherited from Any

Ungrouped