com.opensymphony.webwork.dispatcher
Class ServletDispatcher

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.opensymphony.webwork.dispatcher.ServletDispatcher
All Implemented Interfaces:
WebWorkStatics, Serializable, Servlet, ServletConfig
Direct Known Subclasses:
PicoWebWork2ServletDispatcher

Deprecated. use FilterDispatcher instead

public class ServletDispatcher
extends HttpServlet
implements WebWorkStatics

Main dispatcher servlet in WebWork2 which acts as the controller in the MVC paradigm.

When a request enters the servlet the following things will happen:

  1. The action name is parsed from the servlet path (i.e., /foo/bar/MyAction.action -> MyAction).
  2. A context consisting of the request, response, parameters, session and application properties is created.
  3. An XWork ActionProxy object is instantiated (wraps an Action) using the action name, path, and context then executed.
  4. Action output will channel back through the response to the user.

Any errors occurring during the action execution will result in a HttpServletResponse.SC_INTERNAL_SERVER_ERROR error and any resource errors (i.e., invalid action name or missing JSP page) will result in a HttpServletResponse.SC_NOT_FOUND error.

Instead of traditional servlet init params this servlet will initialize itself using WebWork2 properties. The following properties are used upon initialization:

Author:
Rickard ???berg, Matt Baldree, Jason Carreira, Cameron Braid, Bill Lynch
See Also:
ServletDispatcherResult, Serialized Form

Field Summary
protected static org.apache.commons.logging.Log LOG
          Deprecated. Logger for this class.
 
Fields inherited from interface com.opensymphony.webwork.WebWorkStatics
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER
 
Constructor Summary
ServletDispatcher()
          Deprecated.  
 
Method Summary
 void init(ServletConfig servletConfig)
          Deprecated. Initalizes the servlet.
 void service(HttpServletRequest request, HttpServletResponse response)
          Deprecated. Services the request by determining the desired action to load, building the action context and then executing the action.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Deprecated. 
Logger for this class.

Constructor Detail

ServletDispatcher

public ServletDispatcher()
Deprecated. 
Method Detail

init

public void init(ServletConfig servletConfig)
          throws ServletException
Deprecated. 
Initalizes the servlet. Please read the class documentation for more detail.

Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Parameters:
servletConfig - the ServletConfig object.
Throws:
ServletException - if an error occurs during initialization.

service

public void service(HttpServletRequest request,
                    HttpServletResponse response)
             throws ServletException
Deprecated. 
Services the request by determining the desired action to load, building the action context and then executing the action. This handles all servlet requests including GETs and POSTs.

This method also transparently handles multipart requests.

Overrides:
service in class HttpServlet
Parameters:
request - the HttpServletRequest object.
response - the HttpServletResponse object.
Throws:
ServletException - if an error occurs while loading or executing the action.

WebWork Project Page