+doc add missing migration parts to java documentation
This commit is contained in:
parent
c25e0abab6
commit
c24cac2b04
4 changed files with 42 additions and 5 deletions
|
|
@ -79,7 +79,7 @@ public class StreamTcpDocTest extends AbstractJavaTest {
|
|||
System.out.println("New connection from: " + connection.remoteAddress());
|
||||
|
||||
final Flow<ByteString, ByteString, NotUsed> 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<String, NotUsed> welcome = Source.single(welcomeMsg);
|
||||
final Flow<ByteString, ByteString, NotUsed> 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<ByteString, ByteString, NotUsed> 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("> "))
|
||||
|
|
|
|||
|
|
@ -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<String, NotUsed> 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);
|
||||
|
|
|
|||
|
|
@ -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``.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue