import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class deleteMsg extends HttpServlet { //Initialize global variables FMSInterface fms; public void init(ServletConfig config) throws ServletException { try{ super.init(config); fms = (FMSInterface)System.getProperties().get("MDM.FMServer"); } catch(Exception ex){ ex.printStackTrace(); } } //Process the HTTP Post request public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try{ //Get the values of the parameters message String userName = req.getParameter("userName"); String folder = req.getParameter("folder"); String msgId = req.getParameter("msgId"); fms.deleteMsg(userName, folder, msgId); res.setStatus(res.SC_NO_CONTENT); } catch(NullPointerException ex){ try{ System.out.println("Recreating connection to FMServer"); org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); fms = FMSInterfaceHelper.bind(orb, "FMServer"); System.getProperties().put("MDM.FMServer", fms); } catch(Exception subEx){ subEx.printStackTrace(); } } catch(ClassCastException ex){ try{ System.out.println("Recreating connection to FMServer"); org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); fms = FMSInterfaceHelper.bind(orb, "FMServer"); System.getProperties().put("MDM.FMServer", fms); } catch(Exception subEx){ subEx.printStackTrace(); } } catch(Exception ex){ ex.printStackTrace(); } } public void destroy(){ try{ fms = null; } catch(Exception ex){ ex.printStackTrace(); } } //Get Servlet information public String getServletInfo() { return "deleteMsg Information"; } }