Merge pull request #17042 from ktoso/wip-16972-bindandhandle-renames

!htc #16972 harmonize naming - bindAndHandle...
This commit is contained in:
Konrad Malawski 2015-03-25 15:53:24 +01:00
commit a382071ed7
4 changed files with 21 additions and 21 deletions

View file

@ -60,7 +60,7 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
* connections are being accepted at maximum rate, which, depending on the applications, might * connections are being accepted at maximum rate, which, depending on the applications, might
* present a DoS risk! * present a DoS risk!
*/ */
def bindAndStartHandlingWith(handler: Flow[HttpRequest, HttpResponse, _], def bindAndHandle(handler: Flow[HttpRequest, HttpResponse, _],
interface: String, port: Int = 80, backlog: Int = 100, interface: String, port: Int = 80, backlog: Int = 100,
options: immutable.Traversable[Inet.SocketOption] = Nil, options: immutable.Traversable[Inet.SocketOption] = Nil,
settings: Option[ServerSettings] = None, settings: Option[ServerSettings] = None,
@ -77,12 +77,12 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
* connections are being accepted at maximum rate, which, depending on the applications, might * connections are being accepted at maximum rate, which, depending on the applications, might
* present a DoS risk! * present a DoS risk!
*/ */
def bindAndStartHandlingWithSyncHandler(handler: HttpRequest HttpResponse, def bindAndHandleSync(handler: HttpRequest HttpResponse,
interface: String, port: Int = 80, backlog: Int = 100, interface: String, port: Int = 80, backlog: Int = 100,
options: immutable.Traversable[Inet.SocketOption] = Nil, options: immutable.Traversable[Inet.SocketOption] = Nil,
settings: Option[ServerSettings] = None, settings: Option[ServerSettings] = None,
log: LoggingAdapter = system.log)(implicit fm: FlowMaterializer): Future[ServerBinding] = log: LoggingAdapter = system.log)(implicit fm: FlowMaterializer): Future[ServerBinding] =
bindAndStartHandlingWith(Flow[HttpRequest].map(handler), interface, port, backlog, options, settings, log) bindAndHandle(Flow[HttpRequest].map(handler), interface, port, backlog, options, settings, log)
/** /**
* Materializes the `connections` [[Source]] and handles all connections with the given flow. * Materializes the `connections` [[Source]] and handles all connections with the given flow.
@ -91,12 +91,12 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
* connections are being accepted at maximum rate, which, depending on the applications, might * connections are being accepted at maximum rate, which, depending on the applications, might
* present a DoS risk! * present a DoS risk!
*/ */
def startHandlingWithAsyncHandler(handler: HttpRequest Future[HttpResponse], def bindAndHandleAsync(handler: HttpRequest Future[HttpResponse],
interface: String, port: Int = 80, backlog: Int = 100, interface: String, port: Int = 80, backlog: Int = 100,
options: immutable.Traversable[Inet.SocketOption] = Nil, options: immutable.Traversable[Inet.SocketOption] = Nil,
settings: Option[ServerSettings] = None, settings: Option[ServerSettings] = None,
log: LoggingAdapter = system.log)(implicit fm: FlowMaterializer): Future[ServerBinding] = log: LoggingAdapter = system.log)(implicit fm: FlowMaterializer): Future[ServerBinding] =
bindAndStartHandlingWith(Flow[HttpRequest].mapAsync(handler), interface, port, backlog, options, settings, log) bindAndHandle(Flow[HttpRequest].mapAsync(handler), interface, port, backlog, options, settings, log)
/** /**
* Transforms a given HTTP-level server [[Flow]] into a lower-level TCP transport flow. * Transforms a given HTTP-level server [[Flow]] into a lower-level TCP transport flow.

View file

@ -77,9 +77,9 @@ class ClientServerSpec extends WordSpec with Matchers with BeforeAndAfterAll {
} }
} }
"run with bindAndStartHandlingWith" in { "run with bindAndHandle" in {
val (hostname, port) = temporaryServerHostnameAndPort() val (hostname, port) = temporaryServerHostnameAndPort()
val binding = Http().bindAndStartHandlingWith(Flow[HttpRequest].map(_ HttpResponse()), hostname, port) val binding = Http().bindAndHandle(Flow[HttpRequest].map(_ HttpResponse()), hostname, port)
val b1 = Await.result(binding, 3.seconds) val b1 = Await.result(binding, 3.seconds)
val (_, f) = Http().outgoingConnection(hostname, port) val (_, f) = Http().outgoingConnection(hostname, port)

View file

@ -18,7 +18,7 @@ object TestServer extends App {
implicit val system = ActorSystem("ServerTest", testConf) implicit val system = ActorSystem("ServerTest", testConf)
implicit val fm = ActorFlowMaterializer() implicit val fm = ActorFlowMaterializer()
val binding = Http().bindAndStartHandlingWithSyncHandler({ val binding = Http().bindAndHandleSync({
case HttpRequest(GET, Uri.Path("/"), _, _, _) index case HttpRequest(GET, Uri.Path("/"), _, _, _) index
case HttpRequest(GET, Uri.Path("/ping"), _, _, _) HttpResponse(entity = "PONG!") case HttpRequest(GET, Uri.Path("/ping"), _, _, _) HttpResponse(entity = "PONG!")
case HttpRequest(GET, Uri.Path("/crash"), _, _, _) sys.error("BOOM!") case HttpRequest(GET, Uri.Path("/crash"), _, _, _) sys.error("BOOM!")

View file

@ -28,7 +28,7 @@ object TestServer extends App {
case _ false case _ false
} }
val bindingFuture = Http().bindAndStartHandlingWith({ val bindingFuture = Http().bindAndHandle({
get { get {
path("") { path("") {
complete(index) complete(index)