Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually parsing parameters from put request in tomcat

Tags:

java

tomcat

I have some javascript that uses PUT requests and I'd like to be able to use request.getParameter() to read in variables. I know that Java EE does not parse stuff from PUT requests because HTML PUT was originally intended for file upload. However I am wondering if there is a way to force this behavior anyway or at a minimum how to access the parser Tomcat uses when it parses requests for POST and run it myself on the raw request string.

Thanks.

like image 475
Peter Avatar asked Aug 08 '14 16:08

Peter


1 Answers

The solution appears to be to add the following attribute to the Connector element of server.xml:

parseBodyMethods="POST, PUT"

This tells Tomcat to treat PUT requests like POST requests with respect to parsing the body.

like image 159
Peter Avatar answered Nov 04 '22 01:11

Peter