java.lang.IllegalStateException: Form too large

Description

click Feedback>>Email to Support encounter error 500.
output log at end.

reason: size of image capture screen great than 200000
work-around: increase value of org.eclipse.jetty.server.Request.maxFormContentSize (default is 200000)

solution:current capture screen up to server by convert to base64 and post as textfield.
consider use upload method or how to user other content-type

message is:
WARNING: badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@134c5d11
{r=4,c=false,a=IDLE,uri=-}
Feb 26, 2015 11:33:48 PM org.eclipse.jetty.servlet.ServletHandler doHandle
WARNING: /webui/zkau
java.lang.IllegalStateException: Form too large: 208023 > 200000
at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:364)
at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:302)
at org.eclipse.jetty.server.Request.extractParameters(Request.java:256)
at org.eclipse.jetty.server.Request.getParameter(Request.java:827)
at org.zkoss.zk.au.http.DHtmlUpdateServlet$3.getDesktopId(DHtmlUpdateServlet.java:733)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:531)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494)

Environment

None

Activity

Show:
Hiep Lq
May 31, 2016, 4:36 AM

i guess that increase maxFormContentSize just for work-around.
from jetty: https://www.eclipse.org/jetty/documentation/current/setting-form-size.html

current reason is image capture convert to base64 and post like big string
maybe Blob is solution
https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob
https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects

will test implement late.

Carlos Ruiz
May 31, 2016, 4:43 AM

Thanks , this was also breaking the new feature implemented on to capture images from the webcam.

My first idea was to set the maxFormContentSize programatically from the WImageDialog directly and then we could reset it to the default value.
But I was not able to find the way.

Hiep Lq
May 31, 2016, 7:03 AM

I think current work-around is acceptable.

not sure "set the maxFormContentSize programatically" is good idea.
because MaxFormContentSize is apply per web app, so how about when a user start set it to MAX, but other user just finish upload and reset it to MIN.
you can overcome by use some flag, but it make solution complicate

if you still want it, this's your function
WebAppContext webApp = WebAppContext.getCurrentWebAppContext();
webApp.setMaxFormContentSize(MAX);

plug-in have this code must set dependence to
+ org.eclipse.jetty.webapp
+ org.eclipse.jetty.server
+ org.eclipse.jetty.servlet

Heng Sin Low
November 8, 2020, 8:49 AM

The solution committed is not working anymore with the new version of jetty:
see https://github.com/eclipse/jetty.project/issues/4373 and https://github.com/eclipse/jetty.project/issues/4311

Alternative:

  1. Use system property, -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1048576

  2. add WEB-INF/jetty-web.xml, will attach an example here

  3. use Jetty's ContextHandler api

Hiep Lq
November 8, 2020, 2:01 PM

i think (2) is suitable, because we don't need system wide, configuration per webapp is ok

Fixed

Assignee

Heng Sin Low

Reporter

Hiep Lq

Labels

Tested By

None

Components

Affects versions

Priority

Major