Peter
Peter

Reputation: 1082

Manually parsing parameters from put request in 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.

Upvotes: 5

Views: 1658

Answers (1)

Peter
Peter

Reputation: 1082

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.

Upvotes: 12

Related Questions