简体   繁体   中英

Process a jsf ajax request with a large data form

I have a problem when I try to request a large data (image 6Mo base64 encoded) from my jsf page to my backing bean

  1. I push an image (size 6Mo) Base64 encoded from my websocket endpoint (jetty embedded) to my jsf page using javascript onmessage client
 <h:inputHidden id="myInputHidden" value="#{myBean.base64DataImage}" /> <script> document.getElementById("myForm:myInputHidden").value = data.value; </script> 



2. My action listener is not executed when my base64 string is greater than ~2300000 characters

 <p:commandLink id="myLink" actionListener="#{myBean.myActionListener}" process="@this,myInputHidden" update="@form" /> <script> document.getElementById("myForm:myLink").click(); </script> 



NB : If I put a small image my action listener is executed correctly and I can use my image in my backing bean

Can someone help me to tell me what is the limit of requested form data, and if there's a way to make it larger.

Looks like you have to adjust the max-post-size attribute of you HTTP Connector :

The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).

The default 2,097,152 bytes limit explains why your String of 2,300,000 chars does not succeed to post.

There should have also been errors written to a server log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM