!htc move ServerSettings and ParserSettings up a package to make them accessible both from the java and scala side

This follow the example from akka.stream.
This commit is contained in:
Johannes Rudolph 2015-04-24 16:51:10 +02:00
parent 4537fdebf5
commit d25b3af252
17 changed files with 78 additions and 18 deletions

View file

@ -2,13 +2,15 @@
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.impl.engine.parsing
package akka.http
import java.util.Locale
import akka.actor.ActorSystem
import com.typesafe.config.Config
import scala.collection.JavaConverters._
import akka.http.scaladsl.model.{ StatusCode, HttpMethod, Uri }
import akka.http.impl.util._
import akka.http.impl.engine.parsing.HttpHeaderParser
final case class ParserSettings(
maxUriLength: Int,
@ -88,5 +90,29 @@ object ParserSettings extends SettingsCompanion[ParserSettings]("akka.http.parsi
case x throw new IllegalArgumentException(s"[$x] is not a legal `error-logging-verbosity` setting")
}
}
/**
* Creates an instance of ParserSettings using the configuration provided by the given
* ActorSystem.
*
* Java API
*/
def create(system: ActorSystem): ParserSettings = ParserSettings(system)
/**
* Creates an instance of ParserSettings using the given Config.
*
* Java API
*/
def create(config: Config): ParserSettings = ParserSettings(config)
/**
* Create an instance of ParserSettings using the given String of config overrides to override
* settings set in the class loader of this class (i.e. by application.conf or reference.conf files in
* the class loader of this class).
*
* Java API
*/
def create(configOverrides: String): ParserSettings = ParserSettings(configOverrides)
}

View file

@ -2,17 +2,17 @@
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.scaladsl
package akka.http
import com.typesafe.config.Config
import scala.language.implicitConversions
import scala.concurrent.duration._
import akka.ConfigurationException
import akka.actor.{ ActorRefFactory, ActorSystem }
import akka.http.impl.engine.parsing.ParserSettings
import akka.actor.{ ActorSystem, ActorRefFactory }
import akka.http.impl.util._
import akka.http.scaladsl.model.HttpHeader
import akka.http.scaladsl.model.headers.{ Host, Server }
import com.typesafe.config.Config
import scala.concurrent.duration._
import scala.language.implicitConversions
final case class ServerSettings(
serverHeader: Option[Server],
@ -57,13 +57,28 @@ object ServerSettings extends SettingsCompanion[ServerSettings]("akka.http.serve
def apply(optionalSettings: Option[ServerSettings])(implicit actorRefFactory: ActorRefFactory): ServerSettings =
optionalSettings getOrElse apply(actorSystem)
/** Java API */
def create(system: ActorSystem): ServerSettings = apply(system)
/**
* Creates an instance of ServerSettings using the configuration provided by the given
* ActorSystem.
*
* Java API
*/
def create(system: ActorSystem): ServerSettings = ServerSettings(system)
/** Java API */
def create(config: Config): ServerSettings = apply(config)
/**
* Creates an instance of ServerSettings using the given Config.
*
* Java API
*/
def create(config: Config): ServerSettings = ServerSettings(config)
/** Java API */
def create(configOverrides: String): ServerSettings = apply(configOverrides)
/**
* Create an instance of ServerSettings using the given String of config overrides to override
* settings set in the class loader of this class (i.e. by application.conf or reference.conf files in
* the class loader of this class).
*
* Java API
*/
def create(configOverrides: String): ServerSettings = ServerSettings(configOverrides)
}

View file

@ -4,10 +4,10 @@
package akka.http.impl.engine.client
import akka.http.ParserSettings
import com.typesafe.config.Config
import scala.concurrent.duration.{ FiniteDuration, Duration }
import akka.http.scaladsl.model.headers.`User-Agent`
import akka.http.impl.engine.parsing.ParserSettings
import akka.http.impl.util._
final case class ClientConnectionSettings(

View file

@ -4,6 +4,8 @@
package akka.http.impl.engine.parsing
import akka.http.ParserSettings
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
import akka.parboiled2.CharUtils

View file

@ -5,6 +5,8 @@
package akka.http.impl.engine.parsing
import java.lang.{ StringBuilder JStringBuilder }
import akka.http.ParserSettings
import scala.annotation.tailrec
import akka.actor.ActorRef
import akka.stream.stage.{ Context, PushPullStage }

View file

@ -4,6 +4,8 @@
package akka.http.impl.engine.parsing
import akka.http.ParserSettings
import scala.annotation.tailrec
import akka.http.impl.model.parser.CharacterClasses
import akka.stream.scaladsl.Source

View file

@ -5,6 +5,8 @@
package akka.http.impl.engine
import java.lang.{ StringBuilder JStringBuilder }
import akka.http.ParserSettings
import scala.annotation.tailrec
import akka.event.LoggingAdapter
import akka.util.ByteString

View file

@ -4,6 +4,7 @@
package akka.http.impl.engine.server
import akka.http.ServerSettings
import org.reactivestreams.{ Subscriber, Publisher }
import scala.util.control.NonFatal
import akka.util.ByteString
@ -18,7 +19,6 @@ import akka.http.impl.engine.parsing._
import akka.http.impl.engine.rendering.{ ResponseRenderingContext, HttpResponseRendererFactory }
import akka.http.impl.engine.TokenSourceActor
import akka.http.scaladsl.model._
import akka.http.scaladsl.ServerSettings
import akka.http.impl.util._
import akka.http.impl.engine.ws._
import Websocket.SwitchToWebsocketToken

View file

@ -5,6 +5,8 @@
package akka.http.javadsl
import java.lang.{ Iterable JIterable }
import akka.http.ServerSettings
import scala.concurrent.Future
import akka.japi.Util._
import akka.japi.Function
@ -13,7 +15,7 @@ import akka.event.LoggingAdapter
import akka.io.Inet
import akka.stream.FlowMaterializer
import akka.stream.javadsl.{ Flow, Source }
import akka.http.scaladsl.{ model sm, ServerSettings }
import akka.http.scaladsl.{ model sm }
import akka.http.javadsl.model._
object Http extends ExtensionId[Http] with ExtensionIdProvider {

View file

@ -6,6 +6,7 @@ package akka.http.scaladsl
import java.net.InetSocketAddress
import java.util.concurrent.ConcurrentHashMap
import akka.http.ServerSettings
import com.typesafe.config.Config
import scala.util.Try
import scala.util.control.NonFatal

View file

@ -5,10 +5,12 @@
package akka.http.impl.engine.client
import java.util.concurrent.atomic.AtomicInteger
import akka.http.ServerSettings
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.{ Failure, Success, Try }
import akka.http.scaladsl.{ TestUtils, Http, ServerSettings }
import akka.http.scaladsl.{ TestUtils, Http }
import akka.http.impl.util.{ SingletonException, StreamUtils }
import akka.util.ByteString
import akka.stream.{ BidiShape, ActorFlowMaterializer }

View file

@ -5,6 +5,7 @@
package akka.http.impl.engine.parsing
import java.lang.{ StringBuilder JStringBuilder }
import akka.http.ParserSettings
import com.typesafe.config.{ ConfigFactory, Config }
import scala.annotation.tailrec
import scala.util.Random

View file

@ -1,6 +1,7 @@
package akka.http.impl.engine.parsing
import akka.actor.ActorSystem
import akka.http.ParserSettings
import com.typesafe.config.{ ConfigFactory, Config }
object HttpHeaderParserTestBed extends App {

View file

@ -4,6 +4,7 @@
package akka.http.impl.engine.parsing
import akka.http.ParserSettings
import akka.http.scaladsl.util.FastFuture
import com.typesafe.config.{ ConfigFactory, Config }
import scala.concurrent.Future

View file

@ -4,6 +4,7 @@
package akka.http.impl.engine.parsing
import akka.http.ParserSettings
import akka.http.scaladsl.util.FastFuture
import com.typesafe.config.{ ConfigFactory, Config }
import scala.concurrent.{ Future, Await }

View file

@ -4,6 +4,8 @@
package akka.http.impl.engine.server
import akka.http.ServerSettings
import scala.util.Random
import scala.annotation.tailrec
import scala.concurrent.duration._
@ -13,7 +15,6 @@ import akka.util.ByteString
import akka.stream.scaladsl._
import akka.stream.ActorFlowMaterializer
import akka.stream.testkit._
import akka.http.scaladsl.ServerSettings
import akka.http.scaladsl.model._
import akka.http.impl.util._
import headers._

View file

@ -6,6 +6,7 @@ package akka.http.scaladsl
import java.io.{ BufferedReader, BufferedWriter, InputStreamReader, OutputStreamWriter }
import java.net.Socket
import akka.http.ServerSettings
import com.typesafe.config.{ Config, ConfigFactory }
import scala.annotation.tailrec
import scala.concurrent.Await