Skip to content

Commit

Permalink
Clean up imports, add migration note
Browse files Browse the repository at this point in the history
  • Loading branch information
wsargent committed Jun 17, 2017
1 parent 374fc43 commit cfac489
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!--- Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com> -->
# Play WS Migration Guide

Play WS is now a standalone project and is available at https://github.com/playframework/play-ws. It can be added to an SBT project with:
Play WS is now a standalone project and is available at [https://github.com/playframework/play-ws](https://github.com/playframework/play-ws). It can be added to an SBT project with:

```scala
libraryDependencies += "com.typesafe.play" %% "play-ahc-ws-standalone" % "1.0.0"
libraryDependencies += "com.typesafe.play" %% "play-ahc-ws-standalone-json" % "1.0.0"
libraryDependencies += "com.typesafe.play" %% "play-ahc-ws-standalone-xml" % "1.0.0"
```

## Package changes
Expand Down Expand Up @@ -61,6 +63,8 @@ play.api.test.WsTestClient.withClient { ws =>

The `ning` package has been replaced by the `ahc` package, and the Ning* classes replaced by AHC*.

A normal `WSResponse` instance is returned from `stream()` instead of `StreamedResponse`. You should call `response.bodyAsSource` to return the streamed result.

### Java

In Java, the `play.libs.ws.WS` class has been deprecated. An injected `WSClient` instance should be used instead.
Expand Down Expand Up @@ -89,3 +93,5 @@ WSClient ws = play.test.WsTestClient.newClient(19001);
...
ws.close();
```

A normal `WSResponse` instance is returned from `stream()` instead of `StreamedResponse`. You should call `response.getBodyAsSource()` to return the streamed result.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// #ws-imports
import org.slf4j.Logger;
import play.api.Configuration;
import play.api.libs.ws.InMemoryBody;
import play.core.j.HttpExecutionContext;
import play.core.j.JavaHandlerComponents;
import play.libs.concurrent.Futures;
import play.libs.ws.*;
Expand All @@ -20,8 +18,6 @@
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
// #ws-imports

Expand Down
2 changes: 1 addition & 1 deletion documentation/manual/working/scalaGuide/main/ws/ScalaWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Play WS comes with rich type support for bodies in the form of [`play.api.libs.w

### Creating a Custom Readable

You can create a custom readable by accessing the AHC response body:
You can create a custom readable by accessing the response body:

@[ws-custom-body-readable](code/ScalaWSSpec.scala)

Expand Down

0 comments on commit cfac489

Please sign in to comment.