Donnerstag, 20. Mai 2010

HttpServlet doGet / doPost throwing unexpected Exception

Ever wondered why your HttpServlet on Google AppEngine didn't work, even if the code looks sooooo right?
You might have (accidentally) called super.doPost(...,...); or super.doGet(...,...); which calls the default implementation of HttpServlet, which throws an Exception!
package org.crazy.servlets;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CrazyServlet extends HttpServlet {

 protected void doGet(final HttpServletRequest pReq, final HttpServletResponse pResp) throws ServletException, IOException {
  this.doPost(pReq, pResp);

 protected void doPost(final HttpServletRequest pReq, final HttpServletResponse pResp) throws ServletException, IOException {
   super.doPost(pReq, pResp); // <-- DON'T !!! Just delete this line
  // Insert actual work here...
Took me quite some to figure this out =D


  1. We sell ray ban 2132 wayfarer Sunglasses Resin-tortoise/green hzxmwic into uk area, abusolutely high quality glasses online. Shop in our ray ban sunglasses store,Flaunting on each eye of the followers of fashion can be found with at least one
    pair of ray ban wayfarer 2151 . They offer both sturdy and We are selling ray ban 3025 aviator Sunglasses Glass-gold/dark brown here.
    Choose the Ray Ban you like for free.The cool and trendy ray ban aviator 3026 made by famous designer companies make up your personality. Nowadays, sunglasses with UV ray protection are Shop for ray ban 3183 polarized. Find the best deals on ray ban 3183 polarized , ray ban
    and more on ray ban rb 3194 sunglasses. We carry a huge selection of all Ray Ban sunglasses. 100% free US shipping and easy returns!

  2. Good God! you saved my life and saved me hours of browsing on GAE documentation. Thanks a lot!

  3. Very important codes.Actually my looking over the internate finally end here.Thanks