spray-routing

Spray Routing Doesn't match anything

我与影子孤独终老i 提交于 2019-12-25 12:29:40
问题 I have tried many things, but no matter what I do in my tests (which simply sends a PUT request to "create a user") the logs do not enter any of the pathPrefix and just go to the end and fail to match anything. Can anyone offer insight? Below is the class I have written as well as the simple test (which doesn't even check anything yet) I know overall it is rather rudimentary and I am not doing things great, but it's just something I threw together to the point where I felt i could do a few

How to aggregate akka-http routes using a trait?

回眸只為那壹抹淺笑 提交于 2019-12-12 16:48:26
问题 I am trying to aggregate routes using a trait at runtime, so far I have object SMController { def aggregateRoutes(actorSystem: ActorSystem): List[Route] = { val runtimeMirror = universe.runtimeMirror(getClass.getClassLoader) val reflections = new Reflections("com.example.api") val subclasses = reflections.getSubTypesOf(classOf[Routable]) val routesList = new ListBuffer[Route]() for (i <- subclasses) { val module = runtimeMirror.staticModule(i.getName) val obj = runtimeMirror.reflectModule

Request was not handled with spray-testkit

感情迁移 提交于 2019-12-11 12:32:54
问题 My service route: get( path("add" / IntNumber / IntNumber)( (a, b) => complete((a + b).toString()) ) ) ~ post( path("add") ( formFields('a.as[Int], 'b.as[Int]) { (a, b) => complete((a + b).toString()) }) ) my spec: import spray.http.FormData class RouteDefinitionSpec extends org.specs2.mutable.Specification with org.specs2.ScalaCheck with spray.testkit.Specs2RouteTest with RouteDefinition { def actorRefFactory = system "the route" should { "add with get requests" in { prop { (a: Int, b: Int)

Use a Dispatcher with Spray HttpService

纵饮孤独 提交于 2019-12-11 12:32:37
问题 My application has an API using SprayCan. In the application, any blocking code has a separate dispatcher for each specific resource. Is it necessary to protect the API service from being blocked by the application by configuring it with it's own Dispatcher too? Also is it common practice to use a Router for an API service to handle a larger capacity of requests? class MyService extends Actor with HttpService {...} val service = system.actorOf(MyService.props(...).withDispatcher(???)) 回答1: Is