Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting parameters from PUT HttpServletRequest? [duplicate]

Tags:

java

put

servlets

I have an HttpServlet that is trying to handle a PUT request, that has some form parameters (sent with a "application/x-www-form-urlencoded" header). I have the same setup working fine for POST, but for some reason a PUT request turns up emptywhen I ask for the parameters:

protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws {
   Map<String,String[]> params = req.getParameterMap();
   System.out.println(params.size());
}

the size of params is 0 even though I am passing parameters in.

Is there some other way to read params for a PUT request?

like image 575
Nathan Avatar asked Apr 20 '26 16:04

Nathan


1 Answers

See the the following SO question, seems to answer your question:

Servlet parameters and doPut

like image 196
Suresh Kumar Avatar answered Apr 23 '26 08:04

Suresh Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!