tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Cannot POST to my servlets
Date Fri, 07 Apr 2000 15:54:24 GMT
Juan Alvarez Ferrando wrote:

> Hi again,
> Playing around I've discovered that my servlet is executed, but when it
> does:
> rd = getServletConfig().getServletContext().
>      getRequestDispatcher("/soporte/inicio.html");
> rd.forward(req,res);
> The browser gets an error:
> <h1>Included servlet error: 200</h1>
> <h2>Location: /soporte/servlet/Incidencia</h2>HTTP method POST is not
> supported by this URL

OK, with this I can describe what is happening:

* You did a POST to the servlet that contains this code, right?

* When you do a RequestDispatcher.forward() -- or RequestDispatcher.include()
  for that matter -- the forwarded-to servlet or JSP sees the same request
  that the original request saw -- a POST in this case.

* Note that you are forwarding to an HTML page (presumably static output)
  in this particular scenario.

* Within Tomcat, static HTML pages are served by the "default file serving
  unless you have replaced it.  In this case, I presume you have not.

* The current implementation of the default file-serving servlet in Tomcat
  handles GET requests only, not POSTs.  Thus, it throws this exception.

The solution to this sounds simple on the surface -- make the default servlet
treat a POST like a GET.  I want to do some investigation to make sure there are
no bad side effects before making this change.

> This used to work under WebLogic and NAS. Is this implementation
> dependent?, after reading the Servlet 2.2 spec I could not find a reason
> for this.

Yah, it only says that the default servlet will attempt to serve a resource, but
no details about how :-(.

I'm going to look into this one today, since we're trying to do a release of 3.1

> Thanks again.
> Juan Alvarez Ferrando

Craig McClanahan

View raw message