Re: [akka-user] Akka Http Client - 302 Found no redirect

2015-03-09 Thread Peter Neyens
Thank you for your reponse. 
Good to know much more features for http client are being worked on : 
https://github.com/akka/akka/issues/16856

In the mean time I have resorted to Dispatch to access this webservice.

Peter

Op maandag 9 maart 2015 11:19:18 UTC+1 schreef Patrik Nordwall:



 On Fri, Mar 6, 2015 at 1:05 AM, Peter Neyens peter@gmail.com 
 javascript: wrote:

 Hello,

 I'm trying to access an XML webservice with the akka http client, but 
 always receive a 302 Found response.

 The code I use to do a request :
   lazy val serviceConnection =
 Http().outgoingConnection(hostname-of-service, 80)

   def doRequest(request: HttpRequest): Future[HttpResponse] = 
 Source.single(request).via(serviceConnection).runWith(Sink.head())
   
 When I use 
   val url = new java.net.URL(...)
   scala.xml.XML.load(url)
 I do not receive the 302 Found response and receive the xml response.

 I don't know if akka http client does not follow the redirect 


 I think that can be the case, see issue 
 https://github.com/akka/akka/issues/15990

 /Patrik
  

 or if it is similar to this old spay issue 
 https://groups.google.com/forum/#!topic/spray-user/0agmqlXUtJU.

 Kind regards,
 Peter

 -- 
  Read the docs: http://akka.io/docs/
  Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
 --- 
 You received this message because you are subscribed to the Google Groups 
 Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to akka-user+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 -- 

 Patrik Nordwall
 Typesafe http://typesafe.com/ -  Reactive apps on the JVM
 Twitter: @patriknw

 [image: Scala Days] http://event.scaladays.org/scaladays-sanfran-2015

  

-- 
  Read the docs: http://akka.io/docs/
  Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups Akka 
User List group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Akka Http Client - 302 Found no redirect

2015-03-05 Thread Peter Neyens
Hello,

I'm trying to access an XML webservice with the akka http client, but 
always receive a 302 Found response.

The code I use to do a request :
  lazy val serviceConnection =
Http().outgoingConnection(hostname-of-service, 80)

  def doRequest(request: HttpRequest): Future[HttpResponse] = 
Source.single(request).via(serviceConnection).runWith(Sink.head())
  
When I use 
  val url = new java.net.URL(...)
  scala.xml.XML.load(url)
I do not receive the 302 Found response and receive the xml response.

I don't know if akka http client does not follow the redirect or if it is 
similar to this old spay issue 
https://groups.google.com/forum/#!topic/spray-user/0agmqlXUtJU.

Kind regards,
Peter

-- 
  Read the docs: http://akka.io/docs/
  Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups Akka 
User List group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] [Akka Http 1.0-M4] startHandlingWith / starting server with routes

2015-02-27 Thread Peter Neyens
That works, thank you very much Roland.

Not as nice as the convenience method indeed :-)

Op vrijdag 27 februari 2015 21:33:40 UTC+1 schreef rkuhn:

 Hi Peter,

 the documentation is obviously still lacking, and the Activator template 
 you are citing has not yet been ported to 1.0-M4. But worse than that, 
 bindAndStartHandlingWith has a really stupid bug :-( As a work-around, 
 please use the following instead:

   val server = Http().bind(localhost, 8080)

   
   val future = server.to(Sink.foreach { conn =
 println(sconnection from ${conn.remoteAddress})
 conn.flow.join(route).run()
   }).run()

   

 and then for example:


   future.flatMap(s = {
 println(sbound to ${s.localAddress})
 StdIn.readLine()
 s.unbind()
   }).map(_ = system.shutdown())
   .recover{
 case e: Exception =
   e.printStackTrace()
   system.shutdown()
   }

 (The .run() in the connection handler is missing—we are also obviously 
 lacking a test for the convenience method.)

 Regards,

 Roland

 27 feb 2015 kl. 18:56 skrev Peter Neyens peter@gmail.com 
 javascript::

 Hello,

 I have been playing around with Akka Http the last few days, starting with 
 the excellent Typesafe Activator akka-http-microservice 
 https://github.com/theiterators/akka-http-microservice template.

 When i tried out my application with 
 akka-stream-and-http-experimental-1.0-M4, the easy way to start a http 
 server with routes, stopped working.
   Http().bind(
 interface = config.getString(http.interface),
 port = config.getInt(http.port)
   ).startHandlingWith(routes)

 I tried to look in the source code of Http 
 https://github.com/akka/akka/blob/releasing-akka-stream-and-http-experimental-1.0-M4/akka-http-core/src/main/scala/akka/http/Http.scala,
  
 Route 
 https://github.com/akka/akka/blob/releasing-akka-stream-and-http-experimental-1.0-M4/akka-http/src/main/scala/akka/http/server/Route.scala,
  
 ... milestone 4, but couldn't figure out how to get it working.

 I tried
   Http().bindAndstartHandlingWith(
 handler = Route.handlerFlow(routes),
 interface = config.getString(http.interface),
 port = config.getInt(http.port)
   )
 (also there seems to be a camelCase typo in this method)
 and
   Http().startHandlingWithAsyncHandler(
 handler = Route.asyncHandler(routes),
 interface = config.getString(http.interface),
 port = config.getInt(http.port)
   )

 and with both the server starts up and it logs the requests, but I don't 
 get any results.

 I hope this is not a stupid question, but there could be others who will 
 have the same question.

 Thanks
 Peter

 -- 
  Read the docs: http://akka.io/docs/
  Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
 --- 
 You received this message because you are subscribed to the Google Groups 
 Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to akka-user+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 *Dr. Roland Kuhn*
 *Akka Tech Lead*
 Typesafe http://typesafe.com/ – Reactive apps on the JVM.
 twitter: @rolandkuhn
 http://twitter.com/#!/rolandkuhn
  


-- 
  Read the docs: http://akka.io/docs/
  Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups Akka 
User List group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.