Java Doc for ActionDispatcher.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » actions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 1.3.8 » org.apache.struts.actions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts.actions.ActionDispatcher

All known Subclasses:   org.apache.struts.actions.EventActionDispatcher,
ActionDispatcher
public class ActionDispatcher (Code)

Action helper class that dispatches to a public method in an Action.

This class is provided as an alternative mechanism to using DispatchAction and its various flavours and means Dispatch behaviour can be easily implemented into any Action without having to inherit from a particular super Action.

To implement dispatch behaviour in an Action class, create your custom Action as follows, along with the methods you require (and optionally "cancelled" and "unspecified" methods):

 public class MyCustomAction extends Action {
 protected ActionDispatcher dispatcher
 = new ActionDispatcher(this, ActionDispatcher.MAPPING_FLAVOR);
 public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws Exception {
 return dispatcher.execute(mapping, form, request, response);
 }
 }
 

It provides three flavours of determing the name of the method:

  • ActionDispatcher.DEFAULT_FLAVOR - uses the parameter specified in the struts-config.xml to get the method name from the Request (equivalent to DispatchAction except uses "method" as a default if the parameter is not specified in the struts-config.xml).
  • ActionDispatcher.DISPATCH_FLAVOR - uses the parameter specified in the struts-config.xml to get the method name from the Request (equivalent to DispatchAction).
  • ActionDispatcher.MAPPING_FLAVOR - uses the parameter specified in the struts-config.xml as the method name (equivalent to MappingDispatchAction).

version:
   $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
since:
   Struts 1.2.7


Field Summary
final public static  intDEFAULT_FLAVOR
     Indicates "default" dispatch flavor.
final public static  intDISPATCH_FLAVOR
     Indicates flavor compatible with DispatchAction.
final public static  intMAPPING_FLAVOR
     Indicates "mapping" dispatch flavor.
protected  ActionactionInstance
     The associated Action to dispatch to.
protected  Classclazz
     The Class instance of this DispatchAction class.
protected  intflavor
     Indicates dispatch flavor.
protected static  Loglog
     Commons Logging instance.
protected static  MessageResourcesmessages
     The message resources for this package.
protected  HashMapmethods
     The set of Method objects we have introspected for this class, keyed by method name.
protected  Class[]types
     The set of argument type classes for the reflected method call.

Constructor Summary
public  ActionDispatcher(Action actionInstance)
     Construct an instance of this class from the supplied parameters.
public  ActionDispatcher(Action actionInstance, int flavor)
     Construct an instance of this class from the supplied parameters.

Method Summary
protected  ActionForwardcancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    

Dispatches to the target class' cancelled method, if present, otherwise returns null.

protected  ActionForwarddispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name)
     Dispatch to the specified method.
protected  ActionForwarddispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name, Method method)
     Dispatch to the specified method.
public  ActionForwardexecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it).
protected  MethodgetMethod(String name)
     Introspect the current class to identify a method of the specified name that accepts the same parameter types as the execute method does.
protected  StringgetMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter)
     Returns the method name, given a parameter's value.
protected  StringgetParameter(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    
protected  booleanisCancelled(HttpServletRequest request)
    

Returns true if the current form's cancel button was pressed.

protected  ActionForwardunspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    

Dispatches to the target class' unspecified method, if present, otherwise throws a ServletException.


Field Detail
DEFAULT_FLAVOR
final public static int DEFAULT_FLAVOR(Code)
Indicates "default" dispatch flavor.



DISPATCH_FLAVOR
final public static int DISPATCH_FLAVOR(Code)
Indicates flavor compatible with DispatchAction.



MAPPING_FLAVOR
final public static int MAPPING_FLAVOR(Code)
Indicates "mapping" dispatch flavor.



actionInstance
protected Action actionInstance(Code)
The associated Action to dispatch to.



clazz
protected Class clazz(Code)
The Class instance of this DispatchAction class.



flavor
protected int flavor(Code)
Indicates dispatch flavor.



log
protected static Log log(Code)
Commons Logging instance.



messages
protected static MessageResources messages(Code)
The message resources for this package.



methods
protected HashMap methods(Code)
The set of Method objects we have introspected for this class, keyed by method name. This collection is populated as different methods are called, so that introspection needs to occur only once per method name.



types
protected Class[] types(Code)
The set of argument type classes for the reflected method call. These are the same for all calls, so calculate them only once.




Constructor Detail
ActionDispatcher
public ActionDispatcher(Action actionInstance)(Code)
Construct an instance of this class from the supplied parameters.
Parameters:
  actionInstance - The action instance to be invoked.



ActionDispatcher
public ActionDispatcher(Action actionInstance, int flavor)(Code)
Construct an instance of this class from the supplied parameters.
Parameters:
  actionInstance - The action instance to be invoked.
Parameters:
  flavor - The flavor of dispatch to use.




Method Detail
cancelled
protected ActionForward cancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)

Dispatches to the target class' cancelled method, if present, otherwise returns null. Classes utilizing ActionDispatcher should provide a cancelled method if they wish to provide behavior different than returning null.


Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The non-HTTP request we are processing
Parameters:
  response - The non-HTTP response we are creating The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if the application business logic throws anexception.



dispatchMethod
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name) throws Exception(Code)
Dispatch to the specified method.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The non-HTTP request we are processing
Parameters:
  response - The non-HTTP response we are creating
Parameters:
  name - The name of the method to invoke The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if the application business logic throws anexception.



dispatchMethod
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String name, Method method) throws Exception(Code)
Dispatch to the specified method.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The non-HTTP request we are processing
Parameters:
  response - The non-HTTP response we are creating
Parameters:
  name - The name of the method to invoke
Parameters:
  method - The method to invoke The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if the application business logic throws anexception.



execute
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if an exception occurs



getMethod
protected Method getMethod(String name) throws NoSuchMethodException(Code)
Introspect the current class to identify a method of the specified name that accepts the same parameter types as the execute method does.
Parameters:
  name - Name of the method to be introspected The method with the specified name.
throws:
  NoSuchMethodException - if no such method can be found



getMethodName
protected String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception(Code)
Returns the method name, given a parameter's value.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (ifany)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating
Parameters:
  parameter - The ActionMapping parameter's name The method's name.
throws:
  Exception - if an error occurs.



getParameter
protected String getParameter(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)

Returns the parameter value as influenced by the selected ActionDispatcher.flavor specified for this ActionDispatcher.


Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating The ActionMapping parameter's value
throws:
  Exception - if an error occurs.



isCancelled
protected boolean isCancelled(HttpServletRequest request)(Code)

Returns true if the current form's cancel button was pressed. This method will check if the Globals.CANCEL_KEY request attribute has been set, which normally occurs if the cancel button generated by CancelTag was pressed by the user in the current request. If true, validation performed by an ActionForm's validate() method will have been skipped by the controller servlet.


Parameters:
  request - The servlet request we are processing true if the current form's cancel button waspressed; false otherwise.
See Also:   org.apache.struts.taglib.html.CancelTag



unspecified
protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)

Dispatches to the target class' unspecified method, if present, otherwise throws a ServletException. Classes utilizing ActionDispatcher should provide an unspecified method if they wish to provide behavior different than throwing a ServletException.


Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The non-HTTP request we are processing
Parameters:
  response - The non-HTTP response we are creating The forward to which control should be transferred, ornull if the response has been completed.
throws:
  Exception - if the application business logic throws anexception.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.