Question

The device sends an HTTP PUT request to the tomcat server.And server response '200(OK) status code to indicate success. But I don't know how to receive and response using tomcat .Thanks for any help very much.

Was it helpful?

Solution

You need to read the response body via ServletRequest.getInputStream() or ServletRequest.getReader(). There is no need to set the response code, it will be 200 by default unless an error occurs. You might want to send a response body. See Tomcat's DefaultServlet for how it implements PUT (note that it is disabled by default for security reasons).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top