Skip to content
Permalink
Browse files

Fixes to deprecation

  • Loading branch information...
darkfrog26 committed Jul 18, 2019
1 parent df7977e commit fd6daa790b4630d421ef88bd5a802ce43978a0aa
@@ -285,7 +285,7 @@ trait ServerApplication extends YouIApplication with Server {

def main(args: Array[String]): Unit = {
Profig.loadDefaults()
Profig.merge(args)
Profig.merge(args.toSeq)
start().failed.map { throwable =>
scribe.error("Error during application startup", throwable)
dispose()
@@ -48,6 +48,7 @@ val undertowVersion = "2.0.22.Final"
val closureCompilerVersion = "v20190618"
val jSoupVersion = "1.12.1"
val scalaXMLVersion = "1.2.0"
val collectionCompat = "2.1.1"
val scalaTestVersion = "3.1.0-SNAP13"
val scalaCheckVersion = "1.14.0"

@@ -68,6 +69,7 @@ lazy val macros = crossProject(JSPlatform, JVMPlatform).in(file("macros"))
description := "Dependency for internal Macro functionality",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-collection-compat" % collectionCompat,
"org.scalatest" %%% "scalatest" % scalaTestVersion % "test"
)
)
@@ -15,7 +15,7 @@ import okhttp3.Dns
import io.youi.stream._
import javax.net.ssl.{HostnameVerifier, HttpsURLConnection, SSLContext, SSLSession, SSLSocketFactory, TrustManager, TrustManagerFactory, X509TrustManager}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.{Failure, Success}

@@ -145,8 +145,8 @@ class JVMHttpClientImplementation(config: HttpClientConfig) extends HttpClientIm

// Content
val body = request.content.map {
case StringContent(value, contentType, _) => okhttp3.RequestBody.create(ct(contentType), value)
case FileContent(file, contentType, _) => okhttp3.RequestBody.create(ct(contentType), file)
case StringContent(value, contentType, _) => okhttp3.RequestBody.create(value, ct(contentType))
case FileContent(file, contentType, _) => okhttp3.RequestBody.create(file, ct(contentType))
case FormDataContent(data) => {
val form = new okhttp3.MultipartBody.Builder()
form.setType(ct(ContentType.`multipart/form-data`))
@@ -155,7 +155,7 @@ class JVMHttpClientImplementation(config: HttpClientConfig) extends HttpClientIm
case StringEntry(value, _) => form.addFormDataPart(key, value)
case FileEntry(fileName, file, headers) => {
val partType = Headers.`Content-Type`.value(headers).getOrElse(ContentType.`application/octet-stream`)
val part = okhttp3.RequestBody.create(ct(partType), file)
val part = okhttp3.RequestBody.create(file, ct(partType))
form.addFormDataPart(key, fileName, part)
}
}
@@ -165,7 +165,7 @@ class JVMHttpClientImplementation(config: HttpClientConfig) extends HttpClientIm
case c => throw new RuntimeException(s"Unsupported request content: $c")
}.getOrElse {
if (request.method != HttpMethod.Get) {
okhttp3.RequestBody.create(None.orNull, "")
okhttp3.RequestBody.create("", None.orNull)
} else {
None.orNull
}
@@ -54,6 +54,7 @@ object Maintenance {
status match {
case TaskStatus.Repeat => schedule(task, None, firstRun = false)
case TaskStatus.RepeatNow => schedule(task, Some(0.seconds), firstRun = false)
case TaskStatus.RepeatIn(t) => schedule(task, Some(t), firstRun = false)
case TaskStatus.Stop => // Stop
}
}
@@ -1,9 +1,12 @@
package io.youi.maintenance

import scala.concurrent.duration.FiniteDuration

sealed trait TaskStatus

object TaskStatus {
case object Repeat extends TaskStatus
case object RepeatNow extends TaskStatus
case class RepeatIn(time: FiniteDuration) extends TaskStatus
case object Stop extends TaskStatus
}
@@ -6,7 +6,7 @@ import java.nio.file.attribute.BasicFileAttributes
import java.nio.file._

import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.mutable

abstract class Watcher(directory: Path,
@@ -99,7 +99,7 @@ class Connection {
}

def close(): Unit = if (connected()) {
send.close := ()
send.close := Unit
_connected := false
}
}
@@ -26,7 +26,7 @@ case class Headers(map: TreeMap[String, List[String]] = TreeMap.empty(Ordering.b
object Headers {
val empty: Headers = Headers()

def apply(map: Map[String, List[String]]): Headers = apply(TreeMap[String, List[String]](map.toArray: _*)(Ordering.by(_.toLowerCase)))
def apply(map: Map[String, List[String]]): Headers = apply(TreeMap[String, List[String]](map.toList: _*)(Ordering.by(_.toLowerCase)))

def `Cache-Control`: CacheControl.type = CacheControl
case object `Connection` extends StringHeaderKey("Connection")
@@ -23,7 +23,7 @@ object ResourceServer {
//as resource manager methods are potentially blocking
val dispatchTask: HttpHandler = new HttpHandler() {
@throws[Exception]
def handleRequest(exchange: HttpServerExchange) {
def handleRequest(exchange: HttpServerExchange): Unit = {
val resource: Resource = new FileResource(content.file, defaultResourceManager, content.file.getAbsolutePath)
val etag: ETag = resource.getETag
val lastModified: Date = resource.getLastModified
@@ -26,7 +26,7 @@ import io.youi.stream._
import org.xnio.streams.ChannelInputStream
import org.xnio.{OptionMap, Xnio}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scribe.Execution.global

class UndertowServerImplementation(val server: Server) extends ServerImplementation with UndertowHttpHandler {
@@ -17,7 +17,7 @@ import io.youi.server.util.SSLUtil
import io.youi.util.Time
import org.xnio.{IoFuture, OptionMap, Options, Xnio}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.duration._
import scribe.Execution.global

@@ -8,7 +8,7 @@ import io.youi.http.content._
import io.youi.stream._

import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

object HTMLParser {
private val SelfClosingTagRegex = """(?s)<(\S+)(.*)/>""".r

0 comments on commit fd6daa7

Please sign in to comment.
You can’t perform that action at this time.