public class

ServletDispatcher

extends HttpServlet
java.lang.Object
   ↳ javax.servlet.GenericServlet
     ↳ javax.servlet.http.HttpServlet
       ↳ webwork.dispatcher.ServletDispatcher

Class Overview

Main dispatcher servlet. It works in three phases: first propagate all parameters to the command JavaBean. Second, call execute() to let the JavaBean create the result data. Third, delegate to the JSP that corresponds to the result state that was chosen by the JavaBean.

The command JavaBeans can be found in a package prefixed with either of the package names in the comma-separated "packages" servlet init parameter.

Modified by Raymond Lai (alpha2_valen@yahoo.com) on 1 Nov 2003: modified wrapRequest() to set the character encoding of HttpServletRequest using the parameter "webwork.i18n.encoding" in webwork.properties.

Summary

Constants
String GENERIC_DISPATCHER_FOR_CLEANUP
String STACK_HEAD After a view is processed the value of the stack's head is put into the request attributes with this key.
Fields
protected static Log log
Public Constructors
ServletDispatcher()
Public Methods
void init(ServletConfig config)
Initialize dispatcher servlet
void service(HttpServletRequest aRequest, HttpServletResponse aResponse)
Service a request.
Protected Methods
String getActionName(String name)
Determine action name by extracting last string and removing extension.
String getHTMLErrorMessage(Throwable t)
Return an HTML error message for the throwable
[Expand]
Inherited Methods
From class javax.servlet.http.HttpServlet
From class javax.servlet.GenericServlet
From class java.lang.Object
From interface javax.servlet.Servlet
From interface javax.servlet.ServletConfig

Constants

public static final String GENERIC_DISPATCHER_FOR_CLEANUP

Constant Value: "webwork.generic.dispatcher"

public static final String STACK_HEAD

After a view is processed the value of the stack's head is put into the request attributes with this key.

Constant Value: "webwork.valuestack.head"

Fields

protected static Log log

Public Constructors

public ServletDispatcher ()

Public Methods

public void init (ServletConfig config)

Initialize dispatcher servlet

Throws
ServletException

public void service (HttpServletRequest aRequest, HttpServletResponse aResponse)

Service a request. The request is first checked to see if it is a multi-part. If it is, then the request is wrapped so WW will be able to work with the multi-part as if it was a normal request. Next, we will process all actions until an action returns a non-action which is usually a view. For each action in a chain, the action's context will be first set and then the action will be instantiated. Next, the previous action if this action isn't the first in the chain will have its attributes copied to the current action.

Throws
ServletException

Protected Methods

protected String getActionName (String name)

Determine action name by extracting last string and removing extension. (/.../.../Foo.action -> Foo)

protected String getHTMLErrorMessage (Throwable t)

Return an HTML error message for the throwable

Parameters
t Throwable
Returns
  • A String with an error message