if (charEncoding == null)
charEncoding = CharacterEncoding.getLocalEncoding();
String javaEncoding = Encoding.getJavaName(charEncoding);
MultipartConfigElement multipartConfig
= _invocation.getMultipartConfig();
if (contentType == null || ! "POST".equalsIgnoreCase(getMethod())) {
}
else if (contentType.startsWith("application/x-www-form-urlencoded")) {
formParser.parsePostData(form, getInputStream(), javaEncoding);
}
else if ((getWebApp().doMultipartForm() || multipartConfig != null)
&& contentType.startsWith("multipart/form-data")) {
int length = contentType.length();
int i = contentType.indexOf("boundary=");
if (i < 0)
return form;
long formUploadMax = getWebApp().getFormUploadMax();
long parameterLengthMax = getWebApp().getFormParameterLengthMax();
if (parameterLengthMax < 0)
parameterLengthMax = Long.MAX_VALUE / 2;
Object uploadMax = getAttribute("caucho.multipart.form.upload-max");
if (uploadMax instanceof Number)
formUploadMax = ((Number) uploadMax).longValue();
Object paramMax = getAttribute("caucho.multipart.form.parameter-length-max");
if (paramMax instanceof Number)
parameterLengthMax = ((Number) paramMax).longValue();
// XXX: should this be an error?
if (formUploadMax >= 0 && formUploadMax < contentLength) {
setAttribute("caucho.multipart.form.error",
L.l("Multipart form upload of '{0}' bytes was too large.",
String.valueOf(contentLength)));
setAttribute("caucho.multipart.form.error.size",
new Long(contentLength));
return form;
}
long fileUploadMax = -1;
if (multipartConfig != null) {
formUploadMax = multipartConfig.getMaxRequestSize();
fileUploadMax = multipartConfig.getMaxFileSize();
}
if (multipartConfig != null
&& formUploadMax > 0
&& formUploadMax < contentLength)