webwork/src/docs/manual dispatchers.html,NONE,1.1 index.html,1.15,1.16

[email protected] Sat, 15 Nov 2003 20:14:21 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/docs/manual
In directory sc8-pr-cvs1:/tmp/cvs-serv6071

Modified Files:
	index.html 
Added Files:
	dispatchers.html 
Log Message:
Added dispatcher docs


--- NEW FILE: dispatchers.html ---
<html>
<head>
<title>WebWork Dispatchers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="main.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<a name="background"><h2>Background</h2></a>
Webwork comes with a number of dispatchers to handle usage in different environments.
A dispatcher is a central entry point to webwork's actions. Generally dispatchers are
responsible for setting up the environment for the current request.
<p>
Note that in this context, a request is not necessarily a web request, it can be a remote
request, or a local method call to webwork, as well as the common case of a web HTTP request.
<p>
Since dispatchers are the entry point into webwork, the internals of webwork and actions
have no awareness of the dispatcher used. Thus there is no generic dispatcher interface,
and it is entirely upto a particular dispatcher implementation to determine how it can be
invoked and what it requires from the caller. Dispatchers can perform as much or as little
up front set up as required.
<p>
The servlet dispatcher for example handles web requests, and is more involved that the
other dispatchers available. A brief description of the available dispatchers is below.

<a name="servlet"><h2>Servlet Dispatcher</h2></a>
The ServletDispatcher is the default dispatcher for handling all web HTTP requests. It is
implemented as a servlet, and all calls to webwork actions must pass through this dispatcher.
This is done by specifying the ServletDispatcher servlet in the web application's web.xml
descriptor, and all webwork actions (default of *.action) mapped to this dispatcher servlet.
<p>
When the dispatcher receives an incoming web request, the first step is to determine whether
it is a multipart request with file attachments or not. This is done up front so actions do not
have to handle parsing of multipart requests or have convoluted logic to pull request parameters
based on the type of request. Once that is done, the dispatcher determines the name of the
action requested based on the URL. Internally, the ServletDispatcher is a wrapper around
GenericDispatcher, and simply adds extra handling for web invocation semantics.
<p>
Thus, once the action name has been determined via a web-specific method (URL), a GenericDispatcher
is created for that action, and a generic ActionContext created from that dispatcher.
Since this is a web specific dispatcher, the ServletActionContext is initialized and connected
to the generic ActionContext.
<p>
Finally, the dispatcher initializes the value stack and executes the action to determine the view which
is then displayed.
<a name="generic"><h2>Generic Dispatcher</h2></a>
The generic dispatcher is a dispatcher that is invocation agonistic. it is agonostic in the sense that
it makes no assumptions in that it does handle any pecularities of the invoker, or perform any
mappings from the invoker's environment to webwork's environment. It is invoked simply through a Java
method call.
<p>
Once invoked, the dispatcher performs generic webwork setup. This includes creating an ActionContext,
determining the action being invoked based on the action parameter specified by the invoker, and finally
invoking the requested action. Since this dispatcher is view and invoker agnostic, it has no way of
determining what a view means. So the result of the action invocation is a wrapper object (ActionResult)
which contains a view name (for example, SUCCESS), as well as a List of the actions invoked and any
exception that might have been thrown.
<p>
The generic dispatcher is useful in cases where it needs to be called outside of a web environment.
For example, a java bean that runs within your web container but has no web semantics determining its
behaviour might wish to use the generic dispatcher to invoke a webwork action.
<a name="client"><h2>Client Dispatcher</h2></a>
The client dispatcher is, as the name implies, a dispatcher for remote clients. It works in unison with
a ClientServletDispatcher, and handles all the plumbing required for remote calls.
<p>
In terms of implementation, the client dispatcher opens up an HTTP connection to the remote ClientServletDispatcher,
 and serializes the action to be invoked to the server. The server receives the requested action
 and deserializes it, prepares the context and does all the setup required then invokes the action.
 The action result is serialized back to the client dispatcher, that in turn returns it to the caller.
<p>
All this happens serially, the client (for example, an applet or a swing application) creates the Action to be
invoked, and invokes it on the ClientDispatcher that will return the result of the remote action invocation.
<a name="test"><h2>Test Dispatcher</h2></a>
The test dispatcher is useful when constructing test cases. It does very little up front setup and allows
the caller to specify input parameters alongside the action name, which most other dispatchers do not
allow (with the obvious exception of the ServletDispatcher).
</body>
</html>

Index: index.html
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/docs/manual/index.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- index.html	11 Nov 2003 05:38:30 -0000	1.15
+++ index.html	16 Nov 2003 04:14:19 -0000	1.16
@@ -59,6 +59,14 @@
       <li><a href="fundamentals-api.html">API</a></li>
    </ul>
   </li>
+  <li><b>Dispatchers</b></li>
+   <ul>
+      <li><a href="dispatchers.html">Background</a></li>
+      <li><a href="dispatchers.html#servlet">Servlet Dispatcher</a></li>
+      <li><a href="dispatchers.html#generic">Generic Dispatcher</a></li>
+      <li><a href="dispatchers.html#client">Client Dispatcher</a></li>
+      <li><a href="dispatchers.html#test">Test Dispatcher</a></li>
+   </ul>
   <li><b>Supported Views</b>
    <ul>
       <li><a href="views-jsp.jsp">JavaServer Pages (JSP)</a></li>




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl