- String doParam = req.getParameter("do");
- theLog.printInfo("SerletModuleDispatch: " + sMod.toString() + " with method " + doParam);
- if (doParam == null) {
- if (sMod.defaultAction() != null) doParam = sMod.defaultAction();
- else throw new ServletModuleException("no parameter do supplied!");
- }
+ try {
+ Method method = sMod.getClass().getMethod(doParam,SIGNATURE);
+ if (method != null) {
+ method.invoke(sMod,new Object[] {req,res} );
+ return;
+ }
+ else logger.debug("method lookup unsuccesful");
+ }
+ catch ( NoSuchMethodException e) {
+ throw new ServletModuleException("no such method '"+doParam+"' (" + e.getMessage() + ")");
+ }
+ catch ( SecurityException e) {
+ throw new ServletModuleException("method not allowed!" + e.getMessage());
+ }
+ catch ( InvocationTargetException e) {
+ logger.debug( "invocation target exception: " + e.getMessage());
+ if (e.getTargetException() instanceof ServletModuleUserException) {
+ throw new ServletModuleUserException(e.getTargetException().getMessage());
+ }
+ else {
+ e.printStackTrace();
+ throw new ServletModuleException(e.getTargetException().getMessage());
+ }
+ }
+ catch ( IllegalAccessException e) {
+ throw new ServletModuleException("illegal method not allowed!" + e.getMessage());
+ }