On Sat, Mar 19, 2016 at 2:21 PM, Ajay Verma <ajay_2...@yahoo.com.invalid> wrote:
> Hello, > I'm trying to get multipart forms working in Tomcat 9 over HTTP2 (with TLS > enabled). > > The SSL Connector configuration in server.xml (Tomcat 9) is given > below<Connector port="443" > protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150" > SSLEnabled="true"> > <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> > <SSLHostConfig honorCipherOrder="false" > > <Certificate certificateKeyFile="conf/toeflssl.key" > certificateFile="conf/2_toeflmadeeasy.com.crt" /> > </SSLHostConfig> Multipart form submission does not work (the form > variable values are not retrieved on server in the servlet) with above > connector.The sample multipart form html code is given below<form > name="multiPartForm" method="post" enctype="multipart/form-data"> > <input type="hidden" id="form_submission_type" name="form_submission_type" > value="test"> > File 1:<input type="file" id="file1" name="file1" size="20" value=""> > File 2:<input type="file" id="file2" name="file2" size="20" value=""> > <input type="button" value="Submit" name="submit"> > </form> > I am trying to get form parameters by using the > getParameter("form_submission_type") method on HttpServletRequest, and it > returns null under HTTP2. If I remove the line <UpgradeProtocol > className="org.apache.coyote.http2.Http2Protocol" />) it works. But now I > am not on HTTP2. > > Anyone have any ideas how I can get it to work on HTTP2? > Thanks in advance for any suggestions and comments. > Ajay > I can't speak for Tomcat 9, but for T8 getParameter() won't work on a multi-part form. I vaguely recall there's a Tomcat way of getting the parameters, but I ended up using Apache's FileUpload library which will generate a list of files and parameters for the request. Though I have no idea if FileUpload will work with HTTP2 or not.