1 19 package org.openbravo.base.secureApp; 20 21 import org.openbravo.xmlEngine.XmlDocument; 22 import java.io.*; 23 import javax.servlet.*; 24 import javax.servlet.http.*; 25 import org.openbravo.exception.*; 26 27 28 public class ErrorConnection extends HttpSecureAppServlet { 29 30 31 public void init (ServletConfig config) { 32 super.init(config); 33 boolHist = false; 34 } 35 36 public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { 37 VariablesSecureApp vars = new VariablesSecureApp(request); 38 39 if (vars.commandIn("RECONNECT")) { 40 try { 41 makeConnection(); 42 } catch (PoolNotFoundException ex) { 43 log4j.error("Error captured: " + ex); 44 printPage(response, vars); 45 return; 46 } 47 response.sendRedirect(strDireccion + strServletSinIdentificar); 48 } else printPage(response, vars); 49 } 50 51 void printPage(HttpServletResponse response, VariablesSecureApp vars) throws IOException, ServletException { 52 if (log4j.isDebugEnabled()) log4j.debug("Output: Error connection"); 53 XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/base/secureApp/ErrorConnection").createXmlDocument(); 54 55 response.setContentType("text/html; charset=UTF-8"); 56 PrintWriter out = response.getWriter(); 57 out.println(xmlDocument.print()); 58 out.close(); 59 } 60 61 public String getServletInfo() { 62 return "Servlet that presents the connection error window"; 63 } } 65 | Popular Tags |