Trying to get parameters from a PUT request using HttpServlet#doPut:
public void doPut(HttpServletRequest request, HttpServletResponse response) {
String name = request.getParameter("name");
// name is null
}
Using curl to send the request:
curl -X PUT
--data "name=batman"
--header "Content-Type: text/plain" http://localhost:8080/sample.html
works fine with using doGet and GET curl request. Am I missing something?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…