You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/09/24 00:58:57 UTC
DO NOT REPLY [Bug 12938] New: -
servlets do not register PUT request
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12938>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12938
servlets do not register PUT request
Summary: servlets do not register PUT request
Product: Tomcat 4
Version: 4.0.4 Final
Platform: All
OS/Version: All
Status: NEW
Severity: Blocker
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: bugzilla-apache@codeguild.com
Create a servlet that implements doPut()
public void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("got PUT call");
}
Call it with a client that does a PUT:
public static void main (String args[]) {
try {
// URL url = new URL("http://localhost:8080/blah/servlets/PutServletTest");
URL url = new URL("http://localhost:8080/blah/servlet/com.sri.chemsense.server.PutServletTest");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("PUT");
conn.setDoOutput(true);
conn.setDoInput(true);
// in real servlet, stuff the contents of a ZIP file down output stream
conn.getOutputStream().close();
// get input
InputStream stream = conn.getInputStream();
BufferedInputStream in = new BufferedInputStream(stream);
int i = 0;
while ((i = in.read()) != -1) {
System.out.write(i);
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
The PUT servlet will not initialize, nor will it return a response. Now if that servlet also implements doGet, you can send a GET request, and the servlet will initialize, and only then a PUT request will succeed.
Setting
<load-on-startup>1</load-on-startup>
does not affect the PUT servlet's ability to receive that first request.
Tomcat 3.x does not show this problem, but I have tested on 4.0.3 and 4.0.4 and both show this problem.
The log file shows that the PUT was received, but doesn't seem to find a "registered" servlet.
127.0.0.1 - - [23/Sep/2002:15:45:00 -0800] "PUT /blah/servlet/PutServletTest HTTP/1.1" 405 733
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>