1
我打算使用帶有Play2 HTTP client's methods的Iteratees。 Play2的docs相當複雜。如何使用Play2採用迭代器的HTTP客戶端的方法?
採取了這些方法Play2(此GET method):
/**
* performs a GET with supplied body
* @param consumer that's handling the response
*/
def get[A](consumer: ResponseHeaders => Iteratee[Array[Byte], A]):
Future[Iteratee[Array[Byte], A]] =
prepare("GET").executeStream(consumer)
/**
* performs a PUT with supplied body
* @param consumer that's handling the response
*/
def putAndRetrieveStream[A, T](body: T)
(consumer: ResponseHeaders => Iteratee[Array[Byte], A])
(implicit wrt: Writeable[T], ct: ContentTypeOf[T]):
Future[Iteratee[Array[Byte], A]] =
prepare("PUT", body).executeStream(consumer)
我怎麼把這個get
方法,所以我得到響應的身體Array[Byte]
?我該如何調用putAndRetrieveStream
方法,以便在請求的正文中發送給定的Array[Byte]
?