Problem passing more 1 MB String from client to managed Bean

UI Components for JSF
Post Reply
roschen
Posts: 15
Joined: 02 Sep 2015, 17:31
Location: Kyiv, Ukraine

13 Dec 2018, 10:31

Hi, below is a simplified part of code for uploading files via HTML5, client side is working, but we have problem transferring to server side base64 String (file) larger than 1 MB.
That is on client side Button "Read input field" is not working for large Strings, large Strings simply are not entering Setter of field imageArrayId.
If I see JSF phases "Update Model Values" is just absent in case of large String, while is present for String less 1MB size.
I know that for transferring large data post http requests are not used, but where is it documented? And what is the way out for our case except splitting String to 1MB and using series of post requests?
<h:form id="formWebAdmin">
<h:inputHidden id="imageArrayId" value="#{manageScanFile.imageArray}"/>
<br/>
<h:outputText id="imageArrayOutId" value="#{manageScanFile.imageArray}"/>
<br/>
<div class="row-image-uploads" id="divrow1">
<label for="image_uploads" class="image-uploads-BTN">#{translate.getMessage("Load file")}</label>
<input type="file" id="image_uploads" name="file" style="opacity:0;display:none;" accept="image/*" capture="camera"></input>
<script type="text/javascript">
document.getElementById('image_uploads').addEventListener('change', handleFileSelect, false);
</script>
</div>
<p:commandButton value="Read input field"
process="@form" update="@none"
/>
<p:commandButton value="Write output field"
process="@form" update="formWebAdmin:imageArrayOutId"
/>
<p:commandButton value="Clear output field"
process="@this" update="formWebAdmin:imageArrayOutId"
action="#{manageScanFile.setImageArray('')}"
/>
</h:form>
<script>
function handleFileSelect(evt) {
console.log('handleFileSelect');
var file = evt.target.files; // FileList object
var f = file[0];
if (!f.type.match('image.*')) {
alert("Image only please....");
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
document.getElementById('formWebAdmin:imageArrayId').value = e.target.result;
};
})(f);
reader.readAsDataURL(f);
}
</script>
Eclipse Oxygen
Maven 3.3.3
Primefaces 6.2
PrimeExtension 6.2.9
JBoss 6.4 EAP
Mojarra 2.1.28-jbossorg-6
Chrome

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

13 Dec 2018, 16:37

My gut feeling is this may be a jboss setting? I know in the latest Wildfly Undertow the default is 1MB unless you change the config.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

roschen
Posts: 15
Joined: 02 Sep 2015, 17:31
Location: Kyiv, Ukraine

14 Dec 2018, 09:53

Yes, really, it is jBoss limiting maximum size of post request.
Thanks for the hint
Eclipse Oxygen
Maven 3.3.3
Primefaces 6.2
PrimeExtension 6.2.9
JBoss 6.4 EAP
Mojarra 2.1.28-jbossorg-6
Chrome

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

14 Dec 2018, 13:55

No problem. Glad it solved it!
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests