All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spray.routing.RoutingSettings.scala Maven / Gradle / Ivy

Go to download

A suite of lightweight Scala libraries for building and consuming RESTful web services on top of Akka

There is a newer version: 1.3.1
Show newest version
/*
 * Copyright © 2011-2013 the spray project 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package spray.routing

import com.typesafe.config.Config
import akka.actor.ActorRefFactory
import spray.util._

case class RoutingSettings(
    verboseErrorMessages: Boolean,
    fileChunkingThresholdSize: Long,
    fileChunkingChunkSize: Int,
    fileGetConditional: Boolean,
    users: Config,
    renderVanityFooter: Boolean,
    rangeCountLimit: Int,
    rangeCoalescingThreshold: Long) {

  require(fileChunkingThresholdSize >= 0, "file-chunking-threshold-size must be >= 0")
  require(fileChunkingChunkSize > 0, "file-chunking-chunk-size must be > 0")
  require(rangeCountLimit >= 0, "range-count-limit must be >= 0")
  require(rangeCoalescingThreshold >= 0, "range-coalescing-threshold must be >= 0")
}

object RoutingSettings extends SettingsCompanion[RoutingSettings]("spray.routing") {
  def fromSubConfig(c: Config) = apply(
    c getBoolean "verbose-error-messages",
    c getBytes "file-chunking-threshold-size",
    c getIntBytes "file-chunking-chunk-size",
    c getBoolean "file-get-conditional",
    c getConfig "users",
    c getBoolean "render-vanity-footer",
    c getInt "range-count-limit",
    c getBytes "range-coalescing-threshold")

  implicit def default(implicit refFactory: ActorRefFactory) =
    apply(actorSystem)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy