I have a Tomcat application server and this Java source code:
public class MyServlet extends HttpServlet {
public MyServlet() {}
protected void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// ... PUT code
}
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// ... GET code
}
}
With GET everything is fine. The method doGet is called. But from my iPhone app doing a put the doPut method is not called. Nothing happens on the server, I see nothing in the log files. So what´s wrong? Are there any PUT limitations on Tomcat?
How can I debug this? On the iOS device I use a library which I can tell that PUT shall be used, so it should work, because it is a very common framework.
Does anyone have an idea?
Best Regards Tim.
Use wireshark to trace the packets to make sure you actually get a PUT request.
Or similarly setup a separate access log for tomcat (it is already in the default config file, but commented out I believe) to see what is coming in.
If you open in your favorit texteditor the file conf/server.xml in the tomcat directory then you’ll find near the end :
if you remove the comment tokens all access will be logged to logs/localhost_access_log.
e.g. :