tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohun Biswas <m.bis...@cleartool.com>
Subject error-page and POST vs GET
Date Thu, 01 May 2003 20:59:04 GMT
On Tomcat 4.1.24, I set up an error page to handle ServletExceptions, more 
or less like this:

     <error-page>
         <exception-type>
             javax.servlet.ServletException
         </exception-type>
         <location>
             /errhandler
         </location>
     </error-page>

And it works fine. But then I discovered one servlet that wasn't 
redirecting to this page on ServletException. After looking at it a while I 
narrowed it down to this: if the request is a GET, it works fine. If the 
exact same servlet is called with a POST and throws the same exception, it 
doesn't go to the error page. Here's the trimmed-down servlet:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class LabServlet extends HttpServlet {
     public void doGet(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException
     {
         res.setContentType("text/plain");
         PrintWriter out = res.getWriter();
         throw new ServletException("LAB SERVLET");
     }

     public void doPost(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException
     {
         doGet(req, res);
     }
}

I could not find anywhere in the Servlet 2.3 API where it implies that 
error pages don't work on POSTs. Anyone know what gives?

Thanks,
MB


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message