com.sun.faban.harness.webclient
Class Dispatcher
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.sun.faban.harness.webclient.Dispatcher
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class Dispatcher
- extends HttpServlet
The dispatcher is introduced to reorganize the web interface using clean
MVC interfaces. Not all of Faban is using the dispatcher just yet but
will gradually over time (as it is impossible to re-write everything
at once. The dispatcher will dispatch requests to controller classes with
the following spec:
- The request http://site:9980/controller/my_controller/my_action will
map to a call to the controller class MyController in this package and the
method myAction. In the URL, we use the underbar character ('_') as the
word separator. When translated to Java classes or methods, this will be
mapped to capitalization of the word beginnings. The underbar is removed.
A class name is capitalized, while a method name will start with lower case.
- The controller class can be any plain old Java object (POJO) with
a public no-arg constructor.
- The action methods must be public methods taking two arguments of type
HttpServletRequest and HttpServletResponse. There is no limit on the number
of exceptions the action methods can throw.
- The action methods may be of return type void or of any other
return type.
- The return value, if not null or not of void return type, is translated
to a string using the Object.toString() method. The return value determines
the view JSP to be invoked. Sensibly, any CharSequence type would make a
good return type.
- Author:
- Akara Sucharitakul
- See Also:
- Serialized Form
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Dispatcher
public Dispatcher()
doGet
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Overrides:
doGet
in class HttpServlet
- Throws:
ServletException
IOException
doPost
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Overrides:
doPost
in class HttpServlet
- Throws:
ServletException
IOException