aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java44
1 files changed, 33 insertions, 11 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java
index 72ade4f25..27cd2b5a5 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java
@@ -1,6 +1,7 @@
package at.gv.egovernment.moa.id.entrypoints;
import java.io.IOException;
+import java.util.Iterator;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -142,18 +143,39 @@ public class DispatcherServlet extends AuthServlet {
IModulInfo info = ModulStorage.getModuleByPath(module);
+ IAction moduleAction = null;
+
if (info == null) {
- resp.sendError(HttpServletResponse.SC_NOT_FOUND);
- Logger.error("Protocol " + module + " has no module registered");
- return;
- }
- IAction moduleAction = info.getAction(action);
+ Iterator<IModulInfo> modules = ModulStorage.getAllModules()
+ .iterator();
+ while (modules.hasNext()) {
+ info = modules.next();
+ moduleAction = info.canHandleRequest(req, resp);
+ if (moduleAction != null) {
+ action = moduleAction.getDefaultActionName();
+ module = info.getPath();
+ break;
+ }
+ info = null;
+ }
+
+ if (moduleAction == null) {
+ resp.sendError(HttpServletResponse.SC_NOT_FOUND);
+ Logger.error("Protocol " + module
+ + " has no module registered");
+ return;
+ }
+ }
if (moduleAction == null) {
- resp.sendError(HttpServletResponse.SC_NOT_FOUND);
- Logger.error("Action " + action + " is not available!");
- return;
+ moduleAction = info.getAction(action);
+
+ if (moduleAction == null) {
+ resp.sendError(HttpServletResponse.SC_NOT_FOUND);
+ Logger.error("Action " + action + " is not available!");
+ return;
+ }
}
HttpSession httpSession = req.getSession();
@@ -175,7 +197,7 @@ public class DispatcherServlet extends AuthServlet {
if (protocolRequest == null) {
protocolRequest = info.preProcess(req, resp, action);
- if(protocolRequest != null) {
+ if (protocolRequest != null) {
protocolRequest.setAction(action);
protocolRequest.setModule(module);
}
@@ -188,7 +210,7 @@ public class DispatcherServlet extends AuthServlet {
}
RequestStorage.setPendingRequest(httpSession, protocolRequest);
-
+
if (moduleAction.needAuthentication(protocolRequest, req, resp)) {
if (protocolRequest.isPassiv()
&& protocolRequest.forceAuth()) {
@@ -230,7 +252,7 @@ public class DispatcherServlet extends AuthServlet {
moduleAction.processRequest(protocolRequest, req, resp);
RequestStorage.removePendingRequest(httpSession);
-
+
} catch (Throwable e) {
// Try handle module specific, if not possible rethrow
if (!info.generateErrorMessage(e, req, resp)) {