diff --git a/akka-docs/rst/java/code/docs/stream/io/StreamTcpDocTest.java b/akka-docs/rst/java/code/docs/stream/io/StreamTcpDocTest.java index 6f540eb25b..379a3a20bd 100644 --- a/akka-docs/rst/java/code/docs/stream/io/StreamTcpDocTest.java +++ b/akka-docs/rst/java/code/docs/stream/io/StreamTcpDocTest.java @@ -79,7 +79,7 @@ public class StreamTcpDocTest extends AbstractJavaTest { System.out.println("New connection from: " + connection.remoteAddress()); final Flow echo = Flow.of(ByteString.class) - .via(Framing.delimiter(ByteString.fromString("\n"), 256, false)) + .via(Framing.delimiter(ByteString.fromString("\n"), 256, FramingTruncation.DISALLOW)) .map(ByteString::utf8String) .map(s -> s + "!!!\n") .map(ByteString::fromString); @@ -113,7 +113,7 @@ public class StreamTcpDocTest extends AbstractJavaTest { final Source welcome = Source.single(welcomeMsg); final Flow serverLogic = Flow.of(ByteString.class) - .via(Framing.delimiter(ByteString.fromString("\n"), 256, false)) + .via(Framing.delimiter(ByteString.fromString("\n"), 256, FramingTruncation.DISALLOW)) .map(ByteString::utf8String) //#welcome-banner-chat-server .map(command -> { @@ -149,7 +149,7 @@ public class StreamTcpDocTest extends AbstractJavaTest { .map(elem -> ByteString.fromString(elem + "\n")); final Flow repl = Flow.of(ByteString.class) - .via(Framing.delimiter(ByteString.fromString("\n"), 256, false)) + .via(Framing.delimiter(ByteString.fromString("\n"), 256, FramingTruncation.DISALLOW)) .map(ByteString::utf8String) .map(text -> {System.out.println("Server: " + text); return "next";}) .map(elem -> readLine("> ")) diff --git a/akka-docs/rst/java/code/docs/stream/javadsl/cookbook/RecipeParseLines.java b/akka-docs/rst/java/code/docs/stream/javadsl/cookbook/RecipeParseLines.java index 48fd0787b9..649c4c5040 100644 --- a/akka-docs/rst/java/code/docs/stream/javadsl/cookbook/RecipeParseLines.java +++ b/akka-docs/rst/java/code/docs/stream/javadsl/cookbook/RecipeParseLines.java @@ -8,6 +8,7 @@ import akka.actor.ActorSystem; import akka.stream.ActorMaterializer; import akka.stream.Materializer; import akka.stream.javadsl.Framing; +import akka.stream.javadsl.FramingTruncation; import akka.stream.javadsl.Sink; import akka.stream.javadsl.Source; import akka.testkit.JavaTestKit; @@ -48,7 +49,7 @@ public class RecipeParseLines extends RecipeTest { //#parse-lines final Source lines = rawData - .via(Framing.delimiter(ByteString.fromString("\r\n"), 100, true)) + .via(Framing.delimiter(ByteString.fromString("\r\n"), 100, FramingTruncation.ALLOW)) .map(b -> b.utf8String()); //#parse-lines lines.limit(10).runWith(Sink.seq(), mat).toCompletableFuture().get(1, TimeUnit.SECONDS); diff --git a/akka-docs/rst/java/stream/migration-guide-2.0-2.4-java.rst b/akka-docs/rst/java/stream/migration-guide-2.0-2.4-java.rst index cae5059c07..2ddd2f16ca 100644 --- a/akka-docs/rst/java/stream/migration-guide-2.0-2.4-java.rst +++ b/akka-docs/rst/java/stream/migration-guide-2.0-2.4-java.rst @@ -185,3 +185,39 @@ The old behaviour can be achieved by explicitly draining the entity: response.entity().getDataBytes().runWith(Sink.ignore()) + +Websocket now consistently named WebSocket +------------------------------------------ + +Previously we had a mix of methods and classes called ``websocket`` or ``Websocket``, which was in contradiction with +how the word is spelled in the spec and some other places of Akka HTTP. + +Methods and classes using the word WebSocket now consistently use it as ``WebSocket``, so updating is as simple as +find-and-replacing the lower-case ``s`` to an upper-case ``S`` wherever the word WebSocket appeared. + +Java DSL for Http binding and connections changed +------------------------------------------------- + +In order to minimise the number of needed overloads for each method defined on the ``Http`` extension +a new mini-DSL has been introduced for connecting to hosts given a hostname, port and optional ``ConnectionContext``. + +The availability of the connection context (if it's set to ``HttpsConnectionContext``) makes the server be bound +as an HTTPS server, and for outgoing connections those settings are used instead of the default ones if provided. + +Was:: + + http.cachedHostConnectionPool(toHost("akka.io"), materializer()); + http.cachedHostConnectionPool("akka.io", 80, httpsConnectionContext, materializer()); // does not work anymore + +Replace with:: + + http.cachedHostConnectionPool(toHostHttps("akka.io", 8081), materializer()); + http.cachedHostConnectionPool(toHostHttps("akka.io", 8081).withCustomHttpsContext(httpsContext), materializer()); + + +Framing moved to akka.stream.[javadsl/scaladsl] +----------------------------------------------- + +The ``Framing`` object which can be used to chunk up ``ByteString`` streams into +framing dependent chunks (such as lines) has moved to ``akka.stream.scaladsl.Framing``, +and has gotten a Java DSL equivalent type in ``akka.stream.javadsl.Framing``. diff --git a/akka-docs/rst/scala/code/docs/http/scaladsl/server/FileUploadExamplesSpec.scala b/akka-docs/rst/scala/code/docs/http/scaladsl/server/FileUploadExamplesSpec.scala index 689dac3e9b..06e769d9f6 100644 --- a/akka-docs/rst/scala/code/docs/http/scaladsl/server/FileUploadExamplesSpec.scala +++ b/akka-docs/rst/scala/code/docs/http/scaladsl/server/FileUploadExamplesSpec.scala @@ -8,7 +8,7 @@ import java.io.File import akka.Done import akka.actor.ActorRef import akka.http.scaladsl.model.Multipart.FormData.BodyPart -import akka.stream.io.{ Framing } +import akka.stream.scaladsl.Framing import akka.stream.scaladsl._ import akka.http.scaladsl.model.Multipart import akka.util.ByteString