X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmir%2Fservlet%2FServletModuleDispatch.java;h=f5e841bbec77694a865adf5e8ce7cb26689eb1ff;hb=8297c34c7a424107fd7d1980b6e8e5a3ae26494b;hp=88435d0d85ffd083194ba7a961498a34daaeae74;hpb=cbdce7db065091bb693ae44d633c2c9c8da5be3a;p=mir.git diff --git a/source/mir/servlet/ServletModuleDispatch.java b/source/mir/servlet/ServletModuleDispatch.java index 88435d0d..f5e841bb 100755 --- a/source/mir/servlet/ServletModuleDispatch.java +++ b/source/mir/servlet/ServletModuleDispatch.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mir.servlet; @@ -42,7 +42,7 @@ 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.15 2003/04/21 12:42:50 idfx Exp $ + * @version $Id: ServletModuleDispatch.java,v 1.15.2.1 2003/09/03 17:49:38 zapata Exp $ * * @Author rk * @@ -52,56 +52,52 @@ public final class ServletModuleDispatch { private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Dispatch"); private static final Class[] SIGNATURE = { HttpServletRequest.class, HttpServletResponse.class }; - /** - * private constructor to prevent unwanted instantiation; - */ + /** + * private parameter-less constructor to prevent unwanted instantiation + */ private ServletModuleDispatch () { } /** - * Die Dispatch-Routine ruft das von dem Hauptservlet kommende ServletModule - * mit dem per HttpServletRequest angegebenen Paramter do auf. - * Ist kein Parameter angegeben, so wird versucht, in die defaultAction - * des ServletModules zu springen. + * Method to dispatch servletmodule requests. * - * @param req Http-Request, das vom Dispatcher an die Methode des - * ServletModules durchgereicht wird - * @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 aServletModule + * @param aRequest + * @param aResponse + * @throws ServletModuleExc + * @throws ServletModuleUserExc + * @throws ServletModuleFailure */ - public static void dispatch(ServletModule sMod, HttpServletRequest req, - HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure + public static void dispatch(ServletModule aServletModule, HttpServletRequest aRequest, + HttpServletResponse aResponse) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure { - String doParam = req.getParameter("do"); - logger.info("ServletModuleDispatch: " + sMod.toString() + " with method " + doParam); + String doParam = aRequest.getParameter("do"); + logger.info("ServletModuleDispatch: " + aServletModule.toString() + " with method " + doParam); if (doParam == null) { - if (sMod.defaultAction() != null) - doParam = sMod.defaultAction(); + if (aServletModule.defaultAction() != null) + doParam = aServletModule.defaultAction(); else throw new ServletModuleExc("no parameter do supplied!"); } try { - Method method = sMod.getClass().getMethod(doParam,SIGNATURE); + Method method = aServletModule.getClass().getMethod(doParam,SIGNATURE); if (method != null) { - method.invoke(sMod,new Object[] {req,res} ); + method.invoke(aServletModule,new Object[] {aRequest,aResponse} ); return; } else logger.debug("method lookup unsuccesful"); } catch ( InvocationTargetException e) { - logger.error( "invocation target exception: " + e.getMessage()); + logger.error( "invocation target exception: " + e.toString()); e.getTargetException().printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); throw new ServletModuleFailure(e.getTargetException().getMessage(), e.getTargetException()); } catch (Throwable t) { - logger.error( "ServletModuleDispatch: " + t.getMessage()); - t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); + logger.error( "ServletModuleDispatch: " + t.toString()); throw new ServletModuleFailure(t); } }