This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lightbend.akka.http.sample | |
import java.util.UUID | |
import akka.NotUsed | |
import akka.actor.{ ActorSystem, Cancellable } | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.Source | |
import scala.collection.mutable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val javaVersion = "1.8" | |
scalacOptions in ThisBuild ++= Seq( // Copied from https://tpolecat.github.io/2017/04/25/scalac-flags.html | |
"-target:jvm-" + javaVersion, // | |
"-deprecation", // Emit warning and location for usages of deprecated APIs. | |
"-encoding", "utf-8", // Specify character encoding used by source files. | |
"-explaintypes", // Explain type errors in more detail. | |
"-feature", // Emit warning and location for usages of features that should be imported explicitly. | |
/* "-language:existentials", // Existential types (besides wildcard types) can be written and inferred |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A utiliser avec les ressouces "Closable" (fichers, connections bdd etc...) | |
exemple : | |
def withFile[A](name: String, encoding: String = "UTF-8")(func: Iterator[String] => A): A = { | |
val source = Source.fromFile(name, encoding) | |
val lines = source.getLines() | |
try { | |
func(lines) | |
} finally { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// KEEP CARE TO LET THIS IN THIS PACKAGE | |
// this enables you to acces and extend private[Play] Objects | |
package play.api.libs.ws | |
import scala.concurrent.Future | |
import java.io.File | |
import play.api.http.{ Writeable, ContentTypeOf } | |
import play.api.libs.ws.WS._ | |
import play.api.libs.iteratee.Iteratee |