00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 package org.openmobileis.services.common;
00031
00032 import javax.servlet.http.HttpServletResponse;
00033
00034 import org.openmobileis.embedded.webserver.templates.*;
00035 import freemarker.template.*;
00036 import org.openmobileis.common.util.log.*;
00037
00055 public class ServletTools {
00056
00057
00058
00059
00060
00061 public static void sendErrorPage (String serviceName, String message, String url, HttpServletResponse res) {
00062 try {
00063 res.setContentType("text/html .html");
00064 TemplateModelRoot root = TemplateManager.getManager().getTemplateModelRoot();
00065 root.put("messageDonnees", new SimpleScalar(message));
00066 root.put("serviceName", new SimpleScalar(serviceName));
00067 root.put("url", new SimpleScalar(url));
00068 TemplateManager.getManager().sendResponse ("openmischannel"+java.io.File.separator+"erreurmessage.htm", root, res);
00069 } catch (TemplateNotFoundException ex) {
00070 try {
00071 org.openmobileis.common.intl.IntlResourceManager resourceManager = org.openmobileis.common.intl.IntlResourceManager.getManager();
00072 String title = resourceManager.getLocalizedProperty("ServletTools.ErrorExec");
00073 res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, title);
00074 } catch (Exception exi) {
00075 }
00076 LogManager.traceAlert(LogServices.WEBSERVICE, "Error Template not found name erreurSaisie ");
00077 LogManager.traceAlert(LogServices.WEBSERVICE, ex);
00078 } catch (Exception ex) {
00079 try {
00080 org.openmobileis.common.intl.IntlResourceManager resourceManager = org.openmobileis.common.intl.IntlResourceManager.getManager();
00081 String title = resourceManager.getLocalizedProperty("ServletTools.ErrorExec");
00082 res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, title);
00083 } catch (Exception exi) {
00084 }
00085 LogManager.traceAlert(LogServices.WEBSERVICE, "Error during execution of Service"+serviceName);
00086 LogManager.traceAlert(LogServices.WEBSERVICE, ex);
00087 }
00088 }
00089
00090
00091
00092
00093
00094 public static void sendConfirmationPage (String serviceName, String message, String url, HttpServletResponse res) {
00095 try {
00096 TemplateModelRoot root = TemplateManager.getManager().getTemplateModelRoot();
00097 root.put("messageDonnees", new SimpleScalar(message));
00098 root.put("serviceName", new SimpleScalar(serviceName));
00099 root.put("url", new SimpleScalar(url));
00100 TemplateManager.getManager().sendResponse ("openmischannel"+java.io.File.separator+"confirmationmessage.htm", root, res);
00101 } catch (TemplateNotFoundException ex) {
00102 try {
00103 org.openmobileis.common.intl.IntlResourceManager resourceManager = org.openmobileis.common.intl.IntlResourceManager.getManager();
00104 String title = resourceManager.getLocalizedProperty("ServletTools.ErrorExec");
00105 res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, title);
00106 } catch (Exception exi) {
00107 }
00108 LogManager.traceAlert(LogServices.WEBSERVICE, "Error Template not found name confirmation ");
00109 LogManager.traceAlert(LogServices.WEBSERVICE, ex);
00110 } catch (Exception ex) {
00111 try {
00112 org.openmobileis.common.intl.IntlResourceManager resourceManager = org.openmobileis.common.intl.IntlResourceManager.getManager();
00113 String title = resourceManager.getLocalizedProperty("ServletTools.ErrorExec");
00114 res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, title);
00115 } catch (Exception exi) {
00116 }
00117 LogManager.traceAlert(LogServices.WEBSERVICE, "Error during execution of Service"+serviceName);
00118 LogManager.traceAlert(LogServices.WEBSERVICE, ex);
00119 }
00120 }
00121 }