spray

Parboiled2 causes “missing or invalid dependency detected while loading class file 'Prepender.class'”

非 Y 不嫁゛ 提交于 2019-12-12 11:12:05
问题 So I've been trying to use parboiled2 for the last few weeks now, it is possibly the most difficult dependency to add to a build I have come across in my entire life. My current error is a compile sbt assembly ) error: [error] missing or invalid dependency detected while loading class file 'Prepender.class'. [error] Could not access type PrependAux in package shapeless, [error] because it (or its dependencies) are missing. Check your build definition for [error] missing or conflicting

akka timeout when using spray client for multiple request

孤街醉人 提交于 2019-12-12 10:45:28
问题 Using spray 1.3.2 with akka 2.3.6. (akka is used only for spray). I need to read huge files and for each line make a http request. I read the files line by line with iterator, and for each item make the request. It run successfully for some of the lines but at some time it start to fail with: akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://default/user/IO-HTTP#-35162984]] after [60000 ms] . I first thought I overloading the service, so I set the "spray.can.host-connector.max

How can I tell a specific spray-client request to follow all redirects?

我与影子孤独终老i 提交于 2019-12-12 03:49:57
问题 I have a specific pipeline in my app that must follow all redirects (let's say up to 50 for sanity's sake), across any domain and protocol (e.g. it could follow http://somewhere.com to https://somewhere.else.com), but only for GET requests. No other pipeline in my app should do this. Here's what it looks like now: val pipeline = sendReceive ~> decode(Gzip) ~> decode(Deflate) ~> unmarshal[String] How can I specify this inside the pipeline's configuration in a host-agnostic manner (i.e. not via

decode and encode with argonaut

ε祈祈猫儿з 提交于 2019-12-12 03:34:47
问题 I would like to use the public API of guildWars2 and decode and encode some informations . I am searching for the decode and encode withs argonauts but I did not understand well .can you explain to me the fact of using argonaut. thanks 来源: https://stackoverflow.com/questions/35460608/decode-and-encode-with-argonaut

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

How can I programmatically execute Route of rejection handler and get resulting HttpEntity?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 11:58:50
问题 How can I programmatically execute Route of rejection handler and get resulting HttpEntity ? For example assuming that I have RequestContext object and Rejection object I'd like to execute RejectionHandler.default on it and get HttpEntity . Here is example of what I'd like to do: implicit def myRejectionHandler = RejectionHandler.newBuilder() .handleAll[Rejection] { rejections ⇒ def prefixEntity(entity: ResponseEntity): ResponseEntity = entity match { case HttpEntity.Strict(contentType, data)

How to run a sbt project in docker by using sbt-docker or writing a docker file manually?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 10:12:00
问题 I have been trying to learn to run a sbt project in docker. I also want to use spray. I am following the example provided by sbt-docker in github: https://github.com/marcuslonnberg/sbt-docker/tree/master/examples/package-spray When i pull the project, it works fine and i could run the docker container as well. There is a file inside project > project > PackageSprayBuild.scala I dont know how this file is being used. Also, the the given example doesnt have a plugins.sbt file. Then i tried to

spray-testkit: could not find implicit value for parameter ta:

妖精的绣舞 提交于 2019-12-11 09:36:13
问题 First time spray user close to ripping hair out. trait SampleService extends SimpleRoutingApp with JsonProtocol with SprayJsonSupport { implicit val system: ActorSystem = ActorSystem("test") implicit def context: ExecutionContext = system.dispatcher startServer(interface = "localhost", port = 8888) { path("test") { _ => get { complete { "test" } } } } } import org.scalatest.FlatSpec import spray.testkit.ScalatestRouteTest class ApiSpec extends FlatSpec with ScalatestRouteTest with

DefaultMarshallers missing with scala and spray-routing

痴心易碎 提交于 2019-12-11 08:51:38
问题 I'm new to Scala, and trying to write a little REST API. Here is my route definition : package com.example import akka.actor.Actor import com.example.core.control.CrudController import spray.routing._ class ServiceActor extends Actor with Service { def actorRefFactory = context def receive = runRoute(routes) } trait Service extends HttpService { val crudController = new CrudController() val routes = { path("ads" / IntNumber) { id => get { complete( crudController.getFromElasticSearch(id) ) }

scala, spray, akka - java.lang.OutOfMemoryError: unable to create new native thread

独自空忆成欢 提交于 2019-12-11 03:49:36
问题 While checking the throughput of spray api. Scenario: 25 concurrent users Os: Free BSD Memory: 2GB No Of Cores: 2 At around 13 concurrent users i was getting the following error. [ERROR] [06/29/2015 05:01:56.407] [default-akka.actor.default-dispatcher-2] [ActorSystem(default)] Uncaught error from thread [default-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread