package ccf.transport.http

import org.apache.http.params.HttpConnectionParams

import dispatch.{Http => DispatchHttp}
import dispatch.Http._

import java.net.URL

class HttpImpl(timeoutMillis: Int) extends Http {
  private val http = new DispatchHttp
  init
  def post[T](url: URL, data: String)(block: String => T): T = http(url.toString.POST << data >- { block })
  private def init {
    HttpConnectionParams.setConnectionTimeout(httpClientParams, timeoutMillis)
    HttpConnectionParams.setSoTimeout(httpClientParams, timeoutMillis)
  }
  private def httpClientParams = http.client.getParams
}

Add HTTP access point impl using Databinder Dispatch
transport: Add HTTP access point impl using Databinder Dispatch

Signed-off-by: Karim Osman <94396faf6cc817be76165477038b3cfa832e89a4@reaktor.fi>
Acked-by: Harri Salokorpi <eefb23b8deb8c30dca252cd0ae751b67337dc69f@reaktor.fi>
