* 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;
* 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
*
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 <code>do</code> auf.
- * Ist kein Parameter angegeben, so wird versucht, in die <code>defaultAction</code>
- * 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);
}
}