Closing the connection

27 views
Skip to first unread message

Tim Pigden

unread,
Feb 14, 2015, 11:20:27 AM2/14/15
to akka...@googlegroups.com
I'm using http client to call a service which is returning me an HttpEntity.CloseDelimited

HttpEntity.CloseDelimited
A streaming entity of unspecified length that is delimited by closing the connection ("Connection: close"). Note, that this entity type can only be used in an HttpResponse.
I'm confused about the "Connection: close" bit. Where do I close the connection and how?

my client code looks like this

def getDoc(path: String): Future[HttpResponse] = {
val authorization = headers.Authorization(BasicHttpCredentials(user, password))
val request = HttpRequest(
GET,
uri = root + path,
headers = List(authorization),
protocol = `HTTP/1.0`
)
val conn = Http().outgoingConnection(host, port)
val response = Source.single(request).via(conn.flow).runWith(Sink.head)
response
}

called from this test code
val builder = UriBuilder("exist")
val f = builder.getDoc("apps/demo/data/macbeth.xml")
val waited = Await.result(f, 20 seconds)


Tim Pigden

unread,
Feb 14, 2015, 11:42:34 AM2/14/15
to akka-user@googlegroups com
so calling toStrict on the entity does something useful. But I'm not sure it's the "right" thing.


--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/iMVBr2bPkvg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in England and Wales.
Company Registration No. 2327613 Registered Offices: Suite 6,The Maltings, Hoe Lane, Ware, SG12 9LR England 
This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Optrak Distribution Software Ltd. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.
Reply all
Reply to author
Forward
0 new messages