I can not upload images to Chrome - Play! Framework

1

Hello,

I'm using Play! Framework and I'm having a problem trying to upload images, especially in Google Chrome:

[error] play - Exception caught in RequestBodyHandler
java.nio.channels.ClosedChannelException: null
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.cleanUpWriteBuffer(AbstractNioWorker.java:433)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:128)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:99)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:779)

On the client-side, this is the code that requests the image to upload:

var formData = new FormData();
for (var i = 0; i < $scope.images.length; i++) {
  formData.append('picture' + i, $scope.images[i]);
}

$http.post('/resource/ad/' + id + '/upload', formData, {
  transformRequest: angular.identity,
  headers: {'Content-Type': undefined}
});

On the server, it is implemented like this:

play.mvc.Http.MultipartFormData body = request().body().asMultipartFormData();
List<Http.MultipartFormData.FilePart> files = body.getFiles();

I changed the values of my parameters in the application.conf to:

parsers.MultipartFormData.maxLength=50240K
play.http.parser.maxDiskBuffer=50240K
play.http.parser.maxMemoryBuffer=50240K

The curious thing is that it only happens in Chrome, in Firefox for example, which is the other browser I use, images are loaded normally.

Does anyone have an idea of what might be happening and can you help me solve this problem?

Thank you!

    
asked by anonymous 28.06.2016 / 03:50

0 answers