RE: HTTP method POST is not supported by this URL
Thanks, for taking the time to investigate this. It would be nice if somehow Tomcat could be made to be immune to such application errors. Jim -Original Message- From: Bo Xu [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 5:41 PM To: Tomcat Users List Subject: Re: HTTP method POST is not supported by this URL - Original Message - From: Jim Urban [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 4:07 PM Subject: RE: HTTP method POST is not supported by this URL So, doPost calls itself in an endless loop, sending the servlet into oblivion... Or until a java.lang.StackOverflowError exception is thrown. :) Seriously, if a servlet gets a StackOverflowError does that impact Tomcat? That is, can Tomcat run out of stack space if a loop in a servlet gets out of control. Jim [...] I am testing it :-) * the following is my code: public class Test0 extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); m(); out.println(hahahahaha); out.close(); out=null; } private void m(){ m(); } } * the following is the result: - when I first invoke Test0, I got the following output in my browser - then I can invoke MyServlet class(es) - but if I invoke Test0 _again_, the DOS prompt of TC4.0 closed by itself !! (I didn't use shutdown commond to close it) * output: A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Invoker service() exception at org.apache.catalina.servlets.InvokerServlet.serveRequest(Unknown Source) at org.apache.catalina.servlets.InvokerServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) Root Cause: java.lang.StackOverflowError at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) ... (many...) Bo Dec.04, 2001 -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
You could check to see if the ServletRequest is a HttpServletRequest and do a cast if necessary. However, I would guess most using GenericServlet probably don't bother with the HTTP method, as you suggest. The advantage of using the HttpServlet is that you get some automated http handling, such as some last-modified handling. For details, refer to the jakarta-servletapi or jakarta-servletapi-4 projects to see the source. Cheers, Larry -Original Message- From: Nikola Milutinovic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 1:22 AM To: Tomcat Users List Subject: Re: HTTP method POST is not supported by this URL The service() method in HttpServlet checks the request HTTP method and calls doGet(), doPost(), doHead(), etc. The default implementations in HttpServlet simply output a message to let the world know you messed up. For GenericServlet you override service() and provide your own checking of the HTTP method, if desired. I don't think you can get HTTP method in GenericServlet, since it's service() method is invoked with ServletRequest, not with HttpServletRequest object. ServletRequest object doesn't have HTTP method in it. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
If you POST to a servlet which extends HttpServlet and that servlet doesn't override the doPost() method, the default doPost() method outputs this error message. Cheers, Larry -Original Message- From: Endle, Cory [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 2:29 PM To: 'Tomcat Users List' Subject: HTTP method POST is not supported by this URL Can anyone help me with this one? I am running a simple servlet that that has a form that does a post. When the form is submitted, I get the error message HTTP method POST is not supported by this URL Do I need something in my web.xml file? My web.xml file just defines the servlet and does some simple servlet mapping. Thanks! Cory Endle Seagate/XIOtech E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
Holy Smoke...I know this one...you need to have doGet call doPost like this: public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } pretty slick eh? -Original Message- From: Endle, Cory [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 11:29 AM To: 'Tomcat Users List' Subject: HTTP method POST is not supported by this URL Can anyone help me with this one? I am running a simple servlet that that has a form that does a post. When the form is submitted, I get the error message HTTP method POST is not supported by this URL Do I need something in my web.xml file? My web.xml file just defines the servlet and does some simple servlet mapping. Thanks! Cory Endle Seagate/XIOtech E-mail: [EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
Endle, Cory wrote: Can anyone help me with this one? I am running a simple servlet that that has a form that does a post. When the form is submitted, I get the error message HTTP method POST is not supported by this URL Do I need something in my web.xml file? My web.xml file just defines the servlet and does some simple servlet mapping. Nope. Just define a servlet and the URL mapping to it, like this: servlet servlet-namePartManager/servlet-name servlet-classPartManagerServlet/servlet-class /servlet servlet-mapping servlet-namePartManager/servlet-name url-pattern/servlet/PartManager/url-pattern /servlet-mapping Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
Larry Isaacs wrote: If you POST to a servlet which extends HttpServlet and that servlet doesn't override the doPost() method, the default doPost() method outputs this error message. Why? I thought that the default doPost() just calls service(). I didn't have to override anything in GenericServlet, so you could be right. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
Chad Alan Prey wrote: Holy Smoke...I know this one...you need to have doGet call doPost like this: public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } pretty slick eh? So, doPost calls itself in an endless loop, sending the servlet into oblivion... And doPost, doGet and others are protected not public methods. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
yeah I fat fingered that...take the doPost out of doPost and it works...This is taken form Core Servlets by Hall. -Original Message- From: Nikola Milutinovic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 12:21 PM To: Tomcat Users List Subject: Re: HTTP method POST is not supported by this URL Chad Alan Prey wrote: Holy Smoke...I know this one...you need to have doGet call doPost like this: public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } pretty slick eh? So, doPost calls itself in an endless loop, sending the servlet into oblivion... And doPost, doGet and others are protected not public methods. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
- Original Message - From: Nikola Milutinovic [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 3:18 PM Subject: Re: HTTP method POST is not supported by this URL Larry Isaacs wrote: If you POST to a servlet which extends HttpServlet and that servlet doesn't override the doPost() method, the default doPost() method outputs this error message. Why? I thought that the default doPost() just calls service(). I didn't have to override anything in GenericServlet, so you could be right. Nix. [...] YourServlet extends javax.servlet.http.HttpServlet, and javax.servlet.http.HttpServlet extends javax.servlet.GenericServlet, the following is from HttpServlet in jakarta-servletapi-4-src.zip in www.Apache.org: ... protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String protocol = req.getProtocol(); String msg = lStrings.getString(http.method_post_not_supported); if (protocol.endsWith(1.1)) { resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg); } else { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg); } } ... it doesn't response anything to the client, so you need to override it in YourServlet. Bo Dec.04, 2001 -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
Hi, The service() method in HttpServlet checks the request HTTP method and calls doGet(), doPost(), doHead(), etc. The default implementations in HttpServlet simply output a message to let the world know you messed up. For GenericServlet you override service() and provide your own checking of the HTTP method, if desired. Larry -Original Message- From: Nikola Milutinovic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 3:19 PM To: Tomcat Users List Subject: Re: HTTP method POST is not supported by this URL Larry Isaacs wrote: If you POST to a servlet which extends HttpServlet and that servlet doesn't override the doPost() method, the default doPost() method outputs this error message. Why? I thought that the default doPost() just calls service(). I didn't have to override anything in GenericServlet, so you could be right. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: HTTP method POST is not supported by this URL
So, doPost calls itself in an endless loop, sending the servlet into oblivion... Or until a java.lang.StackOverflowError exception is thrown. :) Seriously, if a servlet gets a StackOverflowError does that impact Tomcat? That is, can Tomcat run out of stack space if a loop in a servlet gets out of control. Jim -Original Message- From: Nikola Milutinovic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 2:21 PM To: Tomcat Users List Subject: Re: HTTP method POST is not supported by this URL Chad Alan Prey wrote: Holy Smoke...I know this one...you need to have doGet call doPost like this: public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException { doPost(req, res); } pretty slick eh? So, doPost calls itself in an endless loop, sending the servlet into oblivion... And doPost, doGet and others are protected not public methods. Nix. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
- Original Message - From: Jim Urban [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 4:07 PM Subject: RE: HTTP method POST is not supported by this URL So, doPost calls itself in an endless loop, sending the servlet into oblivion... Or until a java.lang.StackOverflowError exception is thrown. :) Seriously, if a servlet gets a StackOverflowError does that impact Tomcat? That is, can Tomcat run out of stack space if a loop in a servlet gets out of control. Jim [...] I am testing it :-) * the following is my code: public class Test0 extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); m(); out.println(hahahahaha); out.close(); out=null; } private void m(){ m(); } } * the following is the result: - when I first invoke Test0, I got the following output in my browser - then I can invoke MyServlet class(es) - but if I invoke Test0 _again_, the DOS prompt of TC4.0 closed by itself !! (I didn't use shutdown commond to close it) * output: A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Invoker service() exception at org.apache.catalina.servlets.InvokerServlet.serveRequest(Unknown Source) at org.apache.catalina.servlets.InvokerServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) Root Cause: java.lang.StackOverflowError at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) ... (many...) Bo Dec.04, 2001 -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
- Original Message - From: Bo Xu [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 6:41 PM Subject: Re: HTTP method POST is not supported by this URL - Original Message - From: Jim Urban [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 4:07 PM Subject: RE: HTTP method POST is not supported by this URL So, doPost calls itself in an endless loop, sending the servlet into oblivion... Or until a java.lang.StackOverflowError exception is thrown. :) Seriously, if a servlet gets a StackOverflowError does that impact Tomcat? That is, can Tomcat run out of stack space if a loop in a servlet gets out of control. Jim [...] I am testing it :-) * the following is my code: public class Test0 extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); m(); out.println(hahahahaha); out.close(); out=null; } private void m(){ m(); } } * the following is the result: - when I first invoke Test0, I got the following output in my browser - then I can invoke MyServlet class(es) - but if I invoke Test0 _again_, the DOS prompt of TC4.0 closed by itself !! (I didn't use shutdown commond to close it) * output: A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Invoker service() exception at org.apache.catalina.servlets.InvokerServlet.serveRequest(Unknown Source) at org.apache.catalina.servlets.InvokerServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source) at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source) at java.lang.Thread.run(Thread.java:484) Root Cause: java.lang.StackOverflowError at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) at Test0.m(Test0.java:23) ... (many...) Bo Dec.04, 2001 [...] my another testing result: if I throw a permanent UnavailableException by myself from service(...), I got the following output in my browser: HTTP Status 503 - Servlet invoker is currently unavailable The requested service (Servlet invoker is currently unavailable) is not currently available. and I can invoke it again(I still get the same output), the DOS prompt of TC4.0 doesn't closed by itself. But for the java.lang.StackOverflowError(please see above email), the DOS prompt of TC4.0 closed by itself. testing code: public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); out.println(another testing); throw new UnavailableException(permanent msg); } } Bo Dec.04, 2001 -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: HTTP method POST is not supported by this URL
yeah I fat fingered that...take the doPost out of doPost and it works...This is taken form Core Servlets by Hall. One question - why would you need a HttpServlet? The only time I needed it what when I nedded HttpResponse object, so I could send redirect. And I didn't override doPost(), now I remeber. I just had to override service(), since it was still abstract (which it should be). One needs to override doPost only if one wishes to specifically handle POST requests, I think. Nix.
Re: HTTP method POST is not supported by this URL
YourServlet extends javax.servlet.http.HttpServlet, and javax.servlet.http.HttpServlet extends javax.servlet.GenericServlet, the following is from HttpServlet in jakarta-servletapi-4-src.zip in www.Apache.org: ... protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String protocol = req.getProtocol(); String msg = lStrings.getString(http.method_post_not_supported); if (protocol.endsWith(1.1)) { resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg); } else { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg); } } ... it doesn't response anything to the client, so you need to override it in YourServlet. You are right, but this is interesting, I have overriden the service() method, which in the HttpServlet dispatches a request to an appropriate method. Was it wrong to do that? Should I have left service() as it was and overriden doGet() and doPost() instead? In my servlet I didn't particulary care which HTTP method was used to call the servlet, I just wanted the parameters of the request and I wanted to process them. I realize now that a more strict servlet should pay attention to the HTTP method used to call it. So, any comment? Nix.
Re: HTTP method POST is not supported by this URL
The service() method in HttpServlet checks the request HTTP method and calls doGet(), doPost(), doHead(), etc. The default implementations in HttpServlet simply output a message to let the world know you messed up. For GenericServlet you override service() and provide your own checking of the HTTP method, if desired. I don't think you can get HTTP method in GenericServlet, since it's service() method is invoked with ServletRequest, not with HttpServletRequest object. ServletRequest object doesn't have HTTP method in it. Nix.
Re: HTTP method POST is not supported by this URL
On Wed, 5 Dec 2001, Nikola Milutinovic wrote: Date: Wed, 5 Dec 2001 07:19:28 +0100 From: Nikola Milutinovic [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: HTTP method POST is not supported by this URL YourServlet extends javax.servlet.http.HttpServlet, and javax.servlet.http.HttpServlet extends javax.servlet.GenericServlet, the following is from HttpServlet in jakarta-servletapi-4-src.zip in www.Apache.org: ... protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String protocol = req.getProtocol(); String msg = lStrings.getString(http.method_post_not_supported); if (protocol.endsWith(1.1)) { resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg); } else { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg); } } ... it doesn't response anything to the client, so you need to override it in YourServlet. You are right, but this is interesting, I have overriden the service() method, which in the HttpServlet dispatches a request to an appropriate method. Was it wrong to do that? Should I have left service() as it was and overriden doGet() and doPost() instead? Yes. When you override service(), you override *all* of the automatic stuff that HttpServlet does for you, such as processing HEAD requests correctly -- as well as support for the lastModified() method. In my servlet I didn't particulary care which HTTP method was used to call the servlet, I just wanted the parameters of the request and I wanted to process them. I realize now that a more strict servlet should pay attention to the HTTP method used to call it. So, any comment? Standard practice is to override only the doXxx() methods that you *do* want to implement. One of the things that HttpServlet's service() method does for you is take care of returning not supported errors for all the methods that you chose not to support. Nix. Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]