Questions tagged [scala-dispatch]

Dispatch is a library for asynchronous HTTP interaction. It provides a Scala vocabulary for Java’s async-http-client.

Dispatch is a library for asynchronous HTTP interaction. It provides a Scala vocabulary for Java’s async-http-client.

http://dispatch.databinder.net/Dispatch.html

91 questions
3
votes
2 answers

scala - dispatch example not working

I'm following the very first example in the dispatchdocs - val svc = url("http://api.hostip.info/country.php") val country = Http(svc OK as.String) for (c <- country) println(c) I do not get any output printed. When I change it…
Shwetanka
  • 4,976
  • 11
  • 44
  • 68
3
votes
1 answer

Scala-Dispatch | Log into web site programmably

I'm still fighting with programmatically logging in to one site, My code: val h = new Http val req = url("http://www.smanager.pl/logowanie.php") << Map("username" -> "MYUSERNAME", "password" -> "MYPASSWORD") val handler = req.POST >>>…
daaatz
  • 394
  • 1
  • 2
  • 14
3
votes
2 answers

POST request with JSON in Dispatch and Scala

I'm having trouble making a POST request with a JSON object using Dispatch and Scala. The POST request works fine for sure since I tested it using curl: ~/workspace $ curl -vd 'tracker={"project":"campaign","event":"home","number":"100"}' …
Gaurav Ragtah
  • 123
  • 3
  • 8
2
votes
1 answer

Akka REST service + dispatch

I followed the example here. It works, fine. But now I need to perform some business logic in case get:Get => Required business logic includes using dispatch library. In a nutshell, I do a request to some page, get the data, wrap it in some class,…
George
  • 8,368
  • 12
  • 65
  • 106
2
votes
1 answer

How do I read response headers + body from single POST using scala's dispatch lib

I have been trying to use the dispatch library to download a file via an http POST request. The server returns a "content-disposition" header suggesting a filename for the data file it returns. I have succeeded reading the entire response body as a…
mnacos
  • 1,195
  • 2
  • 8
  • 8
2
votes
0 answers

Can't import Dispatch libraries into my Scala project in Eclipse

I am currently working on getting my Scala setup running in Eclipse. I am trying to use Dispatch for HTTP/REST. It all seems to work fine, up until the point where I try to import the libraries to use them. Here is what I have done: I installed…
Racho
  • 21
  • 3
2
votes
0 answers

Executing More than 3 Futures does not work

I m using dispatch library in my sbt project. When I initialize three future and run them it is working perfectly But I increase one more future then it goes to a loop. My code: //Initializing Futures def sequenceOfFutures() ={ var…
DSKVP
  • 663
  • 2
  • 11
  • 19
2
votes
2 answers

How to get response headers and body in dispatch request?

I want to get both body and headers from dispatch request. How to do this? val response = Http(request OK as.String) for (r <- response) yield { println(r.toString) //prints body // println(r.getHeaders) // ???? how to print headers here ????…
Daniel Cukier
  • 11,502
  • 15
  • 68
  • 123
2
votes
2 answers

Wait for response with timeout in "Dispatch" library

I am going to use Dispatch to write a simple HTTP client. I call dispatch.Http to get a future and call the future to get the response val request = ... val future = Http(request) // call the server asynchronously val response = future() // wait…
Michael
  • 41,026
  • 70
  • 193
  • 341
2
votes
2 answers

How to use the scala dispatch library to send a post request to the server in the Lift?

I want to use the scala dispatch library to send a post request to the server in the Lift. I want to send a post request to the external server and get some information and then use this information in my web app. How can I do this?
Neil.Lv
  • 161
  • 2
  • 8
2
votes
1 answer

working with cookies in dispatch-classic

I need to programmatically log into a backend server, which returns an auth token as a cookie, then use that cookie to make requests going forward. I'm working in Lift 2.4, and everything I read seems to recommend using http-dispatch, but that has…
Mike
  • 916
  • 12
  • 14
2
votes
0 answers

How do I send matrix params using Dispatch?

I'm using version 0.10.1 of dispatch-core and need to send matrix params to a third party REST API. Does anyone have any idea how to do this? Thanks.
Blake
  • 71
  • 4
2
votes
1 answer

databinder dispatch not properly handling HTTP 302 and authentication

I am using dispatch 0.11.0, Scala 2.10 and trying to get this code to work val svc = url("https://my-server/img/cat.jpg").as(username, password) val respBody = Http(svc OK as.Response(_.getResponseBodyAsStream)) respBody onComplete { case…
Bob
  • 8,424
  • 17
  • 72
  • 110
2
votes
0 answers

Set charset when processing xml using Dispatch Databinder 0.10

I'm wrapping an upstream API with a Scalatra application and using Dispatch to make async requests. However, I'm having trouble turning the upstream XML into xml.Elems using Dispatch's built-in XML processing support. I'm trying to do something…
futurechimp
  • 554
  • 4
  • 6
2
votes
1 answer

How can I replace default thread pool in Dispatch?

How can I replace default thread pool in Dispatch ? I see here https://github.com/dispatch/dispatch/blob/master/futures/src/main/scala/Futures.scala that instantiates CachedThreadPool. I'd like to use FixedThreadPool instead.
expert
  • 29,290
  • 30
  • 110
  • 214