Skip to content
Mathias edited this page Jul 26, 2011 · 5 revisions

spray supports a number of configuration parameters that you can use to tweak sprays behavior. These config setting reside next to the akka section in your akka.conf file, in a section called spray. The [Template Project][] comes with a very basic configuration that you can use as the basis for own.

Currently spray supports the following config settings:

  • "root-actor-id", a string containing the id of the [RootService][] actor. You should rarely need to change this. The default is "spray-root-service"
  • "timeout", an integer value representing the number of milliseconds in which a request has to be responded before triggering an async timeout error response. The default is 1000.
  • "set-connection-close-header", a boolean value signifying whether spray should add a Connection: close header to all responses not already having a Connection header. The default is true.
  • "set-date-header", a boolean value signifying whether spray should add a proper Date header to all responses. The default is false since most of the time the web server / servlet container you deploy you spray app in already takes care of setting the Date header.
  • "root-path", an optional string that, if set, is expected as a prefix of all requests URI paths received by the application and automatically removed before route processing. Useful for example in servlet containers where the spray application is deployed under a certain base URL. The default is "not set".
  • "compact-json-printing", a boolean value signifying whether spray should use the CompactPrinter rather than the PrettyPrinter when using [SprayJsonMarshalling][] (also see the Marshalling and Unmarshalling chapter). The default is false.

Additionally the spray config section may contain a sub section called users which contains username / password combinations for the [FromConfigUserPassAuthenticator][] as discussed in the Authentication/Authorization chapter.

Example:

spray {
    timeout = 1000
    users {
        alice = "banana"
        bob = "coconut"
    }
}

Clone this wiki locally