Background
I have a simple html form:
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="hidden" id="p" name="p" />
<input type="hidden" id="n" name="n" />
<input type="file" class="upload-file" id="file" name="file" />
<textarea id="o" name="o"></textarea>
<button type="submit" >Send</button>
</form>
<script>
$(function(){
var fileInput = $('.upload-file');
$('.upload-form').submit(function(e){
$("#n").val($('input[type=file]').val());
if(!fileInput.get(0).files.length){
alert('Select a file');
return false;
}
});
});
</script>
And a simple Rest easy consumer:
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response upload(@MultipartForm FormDTO form) {
form.getData(); //<-- breakpoint here
}
Problem
Trying to upload files below 16KB throws (Doesn't hit the breakpoint):
WARN [org.apache.james.mime4j.parser.MimeEntity] Unexpected end of headers detected. Higher level boundary detected or EOF reached.
WARN [org.apache.james.mime4j.parser.MimeEntity] Invalid header encountered
WARN [org.apache.james.mime4j.parser.MimeEntity] Body part ended prematurely. Boundary detected in header or EOF reached.
ERROR Could find no Content-Disposition header within part.
Files larger than 16 KB are fine and working (Hits the BreakPoint). (Tried increasing character by character until get bigger than 16KB).
Consideration
Is there a minimum post size threshold for Apache, Wildfly, Resteasy or JaxRS?
Thank you
ATTACHMENTS:
Firebug POST file larger than 16KB (Fine!)
-----------------------------3380429991862985457771888012
Content-Disposition: form-data; name="p"
TOKEN
-----------------------------3380429991862985457771888012
Content-Disposition: form-data; name="n"
-----------------------------3380429991862985457771888012
Content-Disposition: form-data; name="file"; filename="filename"
Content-Type: application/octet-stream
LARGE lorem ipsum TEXT OMMITED
-----------------------------3380429991862985457771888012
Content-Disposition: form-data; name="o"
-----------------------------3380429991862985457771888012--
Firebug POST file smaller than 16KB (Not fine!)
-----------------------------10552095891001881326598189114
Content-Disposition: form-data; name="p"
TOKEN
-----------------------------10552095891001881326598189114
Content-Disposition: form-data; name="n"
-----------------------------10552095891001881326598189114
Content-Disposition: form-data; name="file"; filename="fileSmaller"
Content-Type: application/octet-stream
SMALLER lorem ipsum text OMMITED
-----------------------------10552095891001881326598189114
Content-Disposition: form-data; name="o"
-----------------------------10552095891001881326598189114--
Testing Very Bad and Ugly workaround if File is <16KB:
Fills (javascript loop) with 16KB characters (zeros) an input hidden 'x' and submit WORKS and small files can be sent. (Of course it is not recommended)
Redhat issue https://access.redhat.com/solutions/4521051