Skip to content

Commit

Permalink
Merge pull request #818 from tazmaniax/lighthouse-1889-patch
Browse files Browse the repository at this point in the history
[#1889] WS call does not work in play-1.3.0RC2-12-g87e2d3c
  • Loading branch information
xael-fry committed Nov 19, 2014
2 parents 7fc2fd7 + 844cfed commit af47b60
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion framework/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require: &allDependencies
- cglib -> cglib-nodep 3.1
- com.google.code.gson -> gson 2.2.4
- com.jamonapi -> jamon 2.75
- com.ning -> async-http-client 1.8.13
- com.ning -> async-http-client 1.8.14
- commons-beanutils 1.8.3
- commons-codec 1.8
- commons-collections 3.2.1
Expand Down
Binary file removed framework/lib/async-http-client-1.8.13.jar
Binary file not shown.
Binary file added framework/lib/async-http-client-1.8.14.jar
Binary file not shown.
16 changes: 7 additions & 9 deletions framework/src/play/libs/ws/WSAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,9 @@ private void checkFileBody(BoundRequestBuilder builder) {
}
}
try {
byte[] bodyBytes = sb.toString().getBytes( this.encoding );
InputStream bodyInStream = new ByteArrayInputStream( bodyBytes );
builder.setBody( bodyInStream );
} catch ( UnsupportedEncodingException e) {
byte[] bodyBytes = sb.toString().getBytes(this.encoding);
builder.setBody(bodyBytes);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}

Expand Down Expand Up @@ -525,14 +524,13 @@ private void checkFileBody(BoundRequestBuilder builder) {
if (this.parameters != null && !this.parameters.isEmpty()) {
throw new RuntimeException("POST or PUT method with parameters AND body are not supported.");
}
if(this.body instanceof InputStream) {
if (this.body instanceof InputStream) {
builder.setBody((InputStream)this.body);
} else {
try {
byte[] bodyBytes = this.body.toString().getBytes( this.encoding );
InputStream bodyInStream = new ByteArrayInputStream( bodyBytes );
builder.setBody( bodyInStream );
} catch ( UnsupportedEncodingException e) {
byte[] bodyBytes = this.body.toString().getBytes(this.encoding);
builder.setBody(bodyBytes);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
Expand Down

0 comments on commit af47b60

Please sign in to comment.