MultipartFormData maxLength in play 2.5

207 views
Skip to first unread message

Pedro Almeida

unread,
Aug 29, 2016, 8:11:20 AM8/29/16
to play-framework
Hello,

I am migrating my project to Play 2.5.

Previous I had defined a maximum upload size for a MultipartFormData with:

@BodyParser.Of(value = BodyParser.MultipartFormData.class, maxLength = 5 * 1024 * 1024)

In play 2.5 from the documentation, I see that the correct why is now an extend
like so:

public static class Json300Kb extends BodyParser.Json {
 
@Inject
 
public Json300Kb(HttpErrorHandler errorHandler) {
   
super(300 * 1024, errorHandler);
 
}
}

But MultipartFormData does not seem to have a way to define the maxLenght in the constructor


What is the correct away to achieve this in play 2.5 without defining it globally in the config file?

Thanks in advance

Pedro


Dan Deibler

unread,
Sep 7, 2016, 5:38:17 PM9/7/16
to Play Framework
Did you ever find out how this is supposed to work in 2.5? All of my size-limited multipart forms broke ("The attribute maxLength is undefined for the annotation type BodyParser.Of") when I moved to 2.5 and I can't find anything about the change that broke it or how I'm supposed to change my code for 2.5 to accomplish the same thing without writing a bunch of custom body parsers myself, or worse, making everything use the same max size which would be an undesirable change to the behavior of the application itself. The Migration guide doesn't mention this compile-breaking change, from what I can tell. I feel like I must be missing something.

Pedro Almeida

unread,
Sep 7, 2016, 5:48:03 PM9/7/16
to Play Framework
Hi Dan,

no I did not. 

For the time being I decided to define the max size globally because for my particularly app it is not a concern.

Still looking for the correct way to migrate without using custom body parsers....  
Reply all
Reply to author
Forward
0 new messages