X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Fservlet%2FServletModuleDispatch.java;h=1c58dd9984e643f86447f881cec2775be719b9da;hb=1bfd964b53be329b60b4ddc3a8fec43fcfa9da88;hp=b98d35f2d75234827a908740c9d7cddbfc40a23b;hpb=5b2d2279e1d26546a38c5cd3ba3e4f72192e351b;p=mir.git diff --git a/source/mir/servlet/ServletModuleDispatch.java b/source/mir/servlet/ServletModuleDispatch.java index b98d35f2..1c58dd99 100755 --- a/source/mir/servlet/ServletModuleDispatch.java +++ b/source/mir/servlet/ServletModuleDispatch.java @@ -31,31 +31,29 @@ package mir.servlet; -import java.lang.reflect.*; -import javax.servlet.http.*; -import mir.servlet.ServletModuleException; -import mir.misc.*; -import mir.log.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.log.LoggerWrapper; /** * Dispatcher, calls the method passed to ServletModule Class, through the "do" * Parameter (via POST or GET) * - * @version $Id: ServletModuleDispatch.java,v 1.8 2002/10/25 03:25:15 zapata Exp $ + * @version $Id: ServletModuleDispatch.java,v 1.13 2003/03/06 05:40:39 zapata Exp $ * * @Author rk * */ public final class ServletModuleDispatch { - private static LoggerWrapper logger; + private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Dispatch"); private static final Class[] SIGNATURE = { HttpServletRequest.class, HttpServletResponse.class }; - static { - logger = new LoggerWrapper("servlet.dispatch"); - } - /** * private constructor to prevent unwanted instantiation; */ @@ -74,11 +72,11 @@ public final class ServletModuleDispatch { * @param res Http-Response, die vom Dispatcher an die Methode des * ServletModules durchgereicht wird * @param sMod ServletModule, an das dispatched wird. - * @param mod Name des Modules als String (für Logfile) + * @param mod Name des Modules als String (f?r Logfile) */ public static void dispatch(ServletModule sMod, HttpServletRequest req, - HttpServletResponse res) throws ServletModuleException, ServletModuleUserException + HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure { //sMod.predeliver(req,res); @@ -88,7 +86,7 @@ public final class ServletModuleDispatch { if (sMod.defaultAction() != null) doParam = sMod.defaultAction(); else - throw new ServletModuleException("no parameter do supplied!"); + throw new ServletModuleExc("no parameter do supplied!"); } try { @@ -100,26 +98,21 @@ public final class ServletModuleDispatch { else logger.debug("method lookup unsuccesful"); } catch ( NoSuchMethodException e) { - throw new ServletModuleException("no such method '"+doParam+"' (" + e.getMessage() + ")"); + throw new ServletModuleFailure("no such method '"+doParam+"' (" + e.getMessage() + ")", e); } catch ( SecurityException e) { - throw new ServletModuleException("method not allowed!" + e.getMessage()); + throw new ServletModuleFailure("method not allowed!" + e.getMessage(), e); } catch ( InvocationTargetException e) { - System.out.println(e.getMessage()); - if (e.getTargetException() instanceof ServletModuleUserException) { - throw new ServletModuleUserException(e.getTargetException().getMessage()); - } - else { - e.printStackTrace(); - throw new ServletModuleException(e.getTargetException().getMessage()); - } + logger.debug( "invocation target exception: " + e.getMessage()); + + throw new ServletModuleFailure(e.getTargetException().getMessage(), e.getTargetException()); } catch ( IllegalAccessException e) { - throw new ServletModuleException("illegal method not allowed!" + e.getMessage()); + throw new ServletModuleFailure("illegal method not allowed!" + e.getMessage(), e); + } + catch (Throwable t) { + throw new ServletModuleFailure(t); } - -//hopefully we don't get here ... - throw new ServletModuleException("delivery failed! -- "); } }