Hey guys, lately I was studying a bit of Java, when I was taught about a way to implement a controller class, whose resposibility is to redirect the request to an Action, which perfoms a specified work. That was the way I learnt;
@Override
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
try {
String clazz = req.getRequestURI().replaceAll(req.getContextPath() + "/", "").replaceAll(".java", "");
((Action)Class.forName("com.myProject.actions." + clazz).newInstance()).execute(req, res);
} catch (Exception e) {
e.printStackTrace();
}
}
I know that WebForms also works with HANDLERS, which are kind of actions. For example, each .aspx page inherits from a Page object which is a handler for that specified page.
What I couldn't figure out is, which class does get request first and translate it to the specified action (page handler)? Is it a WebForms feature(implementation) or its a IIS resposibility? So, which class represent the main controller for WebForms?
Thank you very much.