The rest class passes the string id = request.getparameter ("id") and can get the ID parameter value passed by the URL
However, the arguments in the put cannot be obtained, as follows
The following are from: http://dbscx.iteye.com/blog/828167
the definition of Put and post:
Controversy over the role of using put and post to insert new resources. New and updated definitions are available in the HTTP1.1 protocol.
Because all browsers do not support the Put method when submitting HTML form data (support for Get and POST), it is difficult to determine which method is the most sensible to use in which case.
The definition of restful is:
Get is used to retrieve a known Resource representation.
Post is used to create a new, dynamically named Resource.
Put is used to edit known Resource. Do not use it to create Resource.
Delete is used to remove known Resource.
Problem:
The HTTP protocol put method uses Tomcatapi,httprequest.getparameter () when using HTTP body to submit parameters, and cannot get parameter values.
Note: If the URL with the Get method is followed by a parameter, the parameter value can be obtained.
Reason:
It is possible that the API can only parse the GET, post form submission. Some other traditional MVC frameworks have similar phenomena.
Solution: Java code protected void DoPut (HttpServletRequest req, HttpServletResponse resp) throws Servletexception, IOException { BufferedReader in = new BufferedReader (New InputStreamReader (Req.getinputstream ())); String Line; while (line = In.readline ())! = null) System.out.println (line); }
Manually parse incoming parameters using the original input stream.
Get HTTP request types such as GET, POST, PUT, delete, etc.
HttpServletRequest request;
Request.getmethod ();