Permalink
Browse files

Add okhttp plugin

  • Loading branch information...
alexarchambault committed Aug 21, 2016
1 parent 0d9a594 commit 29469ffc7ade94a21d205dcbcc03f400678a314b
Showing with 28 additions and 1 deletion.
  1. +11 −1 build.sbt
  2. +17 −0 okhttp/src/main/scala/coursier/cache/protocol/HttpHandler.scala
View
@@ -570,8 +570,18 @@ lazy val `http-server` = project
)
)
lazy val okhttp = project
.dependsOn(cache)
.settings(commonSettings)
.settings(
name := "coursier-okhttp",
libraryDependencies ++= Seq(
"com.squareup.okhttp" % "okhttp-urlconnection" % "2.7.5"
)
)
lazy val `coursier` = project.in(file("."))
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, plugin, web, doc, `http-server`)
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, plugin, web, doc, `http-server`, okhttp)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(releaseSettings)
@@ -0,0 +1,17 @@
package coursier.cache.protocol
import java.net.{URLStreamHandler, URLStreamHandlerFactory}
import com.squareup.okhttp.{OkHttpClient, OkUrlFactory}
object HttpHandler {
lazy val okHttpClient = new OkHttpClient
lazy val okHttpFactory = new OkUrlFactory(okHttpClient)
}
class HttpHandler extends URLStreamHandlerFactory {
def createURLStreamHandler(protocol: String): URLStreamHandler =
HttpHandler.okHttpFactory.createURLStreamHandler(protocol)
}
class HttpsHandler extends HttpHandler

0 comments on commit 29469ff

Please sign in to comment.