=doc #17279 upgrade to new http package layout
This commit is contained in:
parent
d80f241f19
commit
4537fdebf5
12 changed files with 37 additions and 38 deletions
|
|
@ -5,11 +5,10 @@
|
|||
package docs.http
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
import akka.http.model._
|
||||
import akka.http.scaladsl.model._
|
||||
import akka.stream.scaladsl._
|
||||
import akka.stream.testkit.AkkaSpec
|
||||
import scala.concurrent.Future
|
||||
import akka.http.Http
|
||||
|
||||
class HttpServerExampleSpec
|
||||
extends AkkaSpec("akka.actor.default-mailbox.mailbox-type = akka.dispatch.UnboundedMailbox") {
|
||||
|
|
@ -17,7 +16,7 @@ class HttpServerExampleSpec
|
|||
|
||||
"binding example" in {
|
||||
//#bind-example
|
||||
import akka.http.Http
|
||||
import akka.http.scaladsl.Http
|
||||
import akka.stream.ActorFlowMaterializer
|
||||
|
||||
implicit val system = ActorSystem()
|
||||
|
|
@ -34,7 +33,7 @@ class HttpServerExampleSpec
|
|||
}
|
||||
|
||||
"full-server-example" in {
|
||||
import akka.http.Http
|
||||
import akka.http.scaladsl.Http
|
||||
import akka.stream.ActorFlowMaterializer
|
||||
|
||||
implicit val system = ActorSystem()
|
||||
|
|
@ -43,7 +42,7 @@ class HttpServerExampleSpec
|
|||
val serverSource = Http(system).bind(interface = "localhost", port = 8080)
|
||||
|
||||
//#full-server-example
|
||||
import akka.http.model.HttpMethods._
|
||||
import akka.http.scaladsl.model.HttpMethods._
|
||||
import akka.stream.scaladsl.{ Flow, Sink }
|
||||
|
||||
val requestHandler: HttpRequest => HttpResponse = {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package docs.http
|
||||
|
||||
//#import-model
|
||||
import akka.http.model._
|
||||
import akka.http.scaladsl.model._
|
||||
|
||||
//#import-model
|
||||
|
||||
import akka.stream.testkit.AkkaSpec
|
||||
import akka.util.ByteString
|
||||
import akka.http.model.headers.{ GenericHttpCredentials, BasicHttpCredentials }
|
||||
import akka.http.scaladsl.model.headers.{ GenericHttpCredentials, BasicHttpCredentials }
|
||||
import org.scalatest.MustMatchers
|
||||
|
||||
class ModelSpec extends AkkaSpec {
|
||||
|
|
@ -62,7 +62,7 @@ class ModelSpec extends AkkaSpec {
|
|||
|
||||
"deal with headers" in {
|
||||
//#headers
|
||||
import akka.http.model.headers._
|
||||
import akka.http.scaladsl.model.headers._
|
||||
|
||||
// create a ``Location`` header
|
||||
val loc = Location("http://example.com/other")
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
package docs.http.server
|
||||
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.server._
|
||||
import Directives._
|
||||
import akka.http.testkit.ScalatestRouteTest
|
||||
import akka.http.scaladsl.testkit.ScalatestRouteTest
|
||||
import org.scalatest._
|
||||
|
||||
class DirectiveExamplesSpec extends RoutingSpec {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
package docs.http.server
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
import akka.http.server.Route
|
||||
import akka.http.scaladsl.server.Route
|
||||
import akka.stream.ActorFlowMaterializer
|
||||
|
||||
object MyHandler {
|
||||
//# example-1
|
||||
import akka.http.model.HttpResponse
|
||||
import akka.http.model.StatusCodes._
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.model.HttpResponse
|
||||
import akka.http.scaladsl.model.StatusCodes._
|
||||
import akka.http.scaladsl.server._
|
||||
import Directives._
|
||||
|
||||
implicit def myExceptionHandler =
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ package docs.http.server
|
|||
import akka.actor.ActorSystem
|
||||
import akka.stream.ActorFlowMaterializer
|
||||
|
||||
import akka.http.server.{ Route, MissingCookieRejection }
|
||||
import akka.http.scaladsl.server.{ Route, MissingCookieRejection }
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
object MyRejectionHandler {
|
||||
//# example-1
|
||||
import akka.http.model._
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.model._
|
||||
import akka.http.scaladsl.server._
|
||||
import StatusCodes._
|
||||
import Directives._
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class RejectionHandlerExamplesSpec extends RoutingSpec {
|
|||
}
|
||||
|
||||
"example-2" in {
|
||||
import akka.http.coding.Gzip
|
||||
import akka.http.scaladsl.coding.Gzip
|
||||
|
||||
val route =
|
||||
path("order") {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
package docs.http.server
|
||||
|
||||
import akka.http.server.Directives
|
||||
import akka.http.testkit.ScalatestRouteTest
|
||||
import akka.http.scaladsl.server.Directives
|
||||
import akka.http.scaladsl.testkit.ScalatestRouteTest
|
||||
import org.scalatest.{ Matchers, WordSpec }
|
||||
|
||||
abstract class RoutingSpec extends WordSpec with Matchers with Directives with ScalatestRouteTest
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.model.headers.RawHeader
|
||||
import akka.http.server.RouteResult.Rejected
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.model.headers.RawHeader
|
||||
import akka.http.scaladsl.server.RouteResult.Rejected
|
||||
import akka.http.scaladsl.server._
|
||||
import akka.util.ByteString
|
||||
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
import akka.http.model._
|
||||
import akka.http.scaladsl.model._
|
||||
|
||||
class BasicDirectivesExamplesSpec extends RoutingSpec {
|
||||
"0extract" in {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.coding._
|
||||
import akka.http.model.{ HttpResponse, StatusCodes }
|
||||
import akka.http.model.headers.{ HttpEncodings, HttpEncoding, `Accept-Encoding`, `Content-Encoding` }
|
||||
import akka.http.model.headers.HttpEncodings._
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.coding._
|
||||
import akka.http.scaladsl.model.{ HttpResponse, StatusCodes }
|
||||
import akka.http.scaladsl.model.headers.{ HttpEncodings, HttpEncoding, `Accept-Encoding`, `Content-Encoding` }
|
||||
import akka.http.scaladsl.model.headers.HttpEncodings._
|
||||
import akka.http.scaladsl.server._
|
||||
import akka.util.ByteString
|
||||
import org.scalatest.matchers.Matcher
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.server._
|
||||
import akka.http.model.headers.{ HttpCookie, Cookie, `Set-Cookie` }
|
||||
import akka.http.util.DateTime
|
||||
import akka.http.scaladsl.server._
|
||||
import akka.http.scaladsl.model.headers.{ HttpCookie, Cookie, `Set-Cookie` }
|
||||
import akka.http.scaladsl.model.DateTime
|
||||
|
||||
class CookieDirectivesExamplesSpec extends RoutingSpec {
|
||||
"cookie" in {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.model.{ HttpResponse, HttpRequest }
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.model.{ HttpResponse, HttpRequest }
|
||||
import akka.http.scaladsl.server._
|
||||
|
||||
import akka.event.Logging
|
||||
import akka.http.server.directives.{ LoggingMagnet, LogEntry, DebuggingDirectives }
|
||||
import akka.http.scaladsl.server.directives.{ LoggingMagnet, LogEntry, DebuggingDirectives }
|
||||
|
||||
class DebuggingDirectivesExamplesSpec extends RoutingSpec {
|
||||
"logRequest-0" in {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.model.StatusCodes
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.model.StatusCodes
|
||||
import akka.http.scaladsl.server._
|
||||
|
||||
class ExecutionDirectivesExamplesSpec extends RoutingSpec {
|
||||
"handleExceptions" in {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package docs.http.server
|
||||
package directives
|
||||
|
||||
import akka.http.server._
|
||||
import akka.http.scaladsl.server._
|
||||
|
||||
class PathDirectivesExamplesSpec extends RoutingSpec {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue