
calaxb_2.13.1.12.2.source-code.httpclients_dispatch2000.scala.template Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalaxb_2.13 Show documentation
Show all versions of scalaxb_2.13 Show documentation
scalaxb is an XML data-binding tool for Scala that supports W3C XML Schema (xsd) and wsdl.
package scalaxb
import java.nio.charset.Charset
import java.time.Duration
import scala.concurrent._, duration._
import scala.jdk.DurationConverters._
trait DispatchHttpClients extends HttpClients {
lazy val httpClient = new DispatchHttpClient {}
def requestTimeout: scala.concurrent.duration.FiniteDuration = 60.seconds
def connectionTimeout: scala.concurrent.duration.FiniteDuration = 5.seconds
trait DispatchHttpClient extends HttpClient {
import dispatch._, Defaults._
// Keep it lazy. See https://github.com/eed3si9n/scalaxb/pull/279
lazy val http = Http.withConfiguration(_.
setRequestTimeout(requestTimeout.toJava).
setConnectTimeout(connectionTimeout.toJava))
def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
val req = url(address.toString).setBodyEncoding(Charset.forName("UTF-8")) <:< headers << in
val s = http(req > as.String)
s()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy