Java Doc for DefaultActionMapper.java in  » Web-Framework » struts-2.0.11 » org » apache » struts2 » dispatcher » mapper » 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 2.0.11 » org.apache.struts2.dispatcher.mapper 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts2.dispatcher.mapper.DefaultActionMapper

All known Subclasses:   org.apache.struts2.dispatcher.mapper.Restful2ActionMapper,
DefaultActionMapper
public class DefaultActionMapper implements ActionMapper(Code)
Default action mapper implementation, using the standard *.[ext] (where ext usually "action") pattern. The extension is looked up from the Struts configuration key struts.action.exection.

To help with dealing with buttons and other related requirements, this mapper (and other ActionMapper s, we hope) has the ability to name a button with some predefined prefix and have that button name alter the execution behaviour. The four prefixes are:

  • Method prefix - method:default
  • Action prefix - action:dashboard
  • Redirect prefix - redirect:cancel.jsp
  • Redirect-action prefix - redirect-action:cancel

In addition to these four prefixes, this mapper also understands the action naming pattern of foo!bar in either the extension form (eg: foo!bar.action) or in the prefix form (eg: action:foo!bar). This syntax tells this mapper to map to the action named foo and the method bar.

Method Prefix

With method-prefix, instead of calling baz action's execute() method (by default if it isn't overriden in struts.xml to be something else), the baz action's anotherMethod() will be called. A very elegant way determine which button is clicked. Alternatively, one would have submit button set a particular value on the action when clicked, and the execute() method decides on what to do with the setted value depending on which button is clicked.

 <!-- START SNIPPET: method-example -->
 <a:form action="baz">
 <a:textfield label="Enter your name" name="person.name"/>
 <a:submit value="Create person"/>
 <a:submit name="method:anotherMethod" value="Cancel"/>
 </a:form>
 <!-- END SNIPPET: method-example -->
 

Action prefix

With action-prefix, instead of executing baz action's execute() method (by default if it isn't overriden in struts.xml to be something else), the anotherAction action's execute() method (assuming again if it isn't overriden with something else in struts.xml) will be executed.

 <!-- START SNIPPET: action-example -->
 <a:form action="baz">
 <a:textfield label="Enter your name" name="person.name"/>
 <a:submit value="Create person"/>
 <a:submit name="action:anotherAction" value="Cancel"/>
 </a:form>
 <!-- END SNIPPET: action-example -->
 

Redirect prefix

With redirect-prefix, instead of executing baz action's execute() method (by default it isn't overriden in struts.xml to be something else), it will get redirected to, in this case to www.google.com. Internally it uses ServletRedirectResult to do the task.

 <!-- START SNIPPET: redirect-example -->
 <a:form action="baz">
 <a:textfield label="Enter your name" name="person.name"/>
 <a:submit value="Create person"/>
 <a:submit name="redirect:www.google.com" value="Cancel"/>
 </a:form>
 <!-- END SNIPPET: redirect-example -->
 

Redirect-action prefix

With redirect-action-prefix, instead of executing baz action's execute() method (by default it isn't overriden in struts.xml to be something else), it will get redirected to, in this case 'dashboard.action'. Internally it uses ServletRedirectResult to do the task and read off the extension from the struts.properties.

 <!-- START SNIPPET: redirect-action-example -->
 <a:form action="baz">
 <a:textfield label="Enter your name" name="person.name"/>
 <a:submit value="Create person"/>
 <a:submit name="redirect-action:dashboard" value="Cancel"/>
 </a:form>
 <!-- END SNIPPET: redirect-action-example -->
 

Inner Class :interface ParameterAction

Field Summary
final static  StringACTION_PREFIX
    
final static  StringMETHOD_PREFIX
    
final static  StringREDIRECT_ACTION_PREFIX
    
final static  StringREDIRECT_PREFIX
    
 Listextensions
    

Constructor Summary
public  DefaultActionMapper()
    

Method Summary
 StringdropExtension(String name)
    
 StringgetDefaultExtension()
     Returns null if no extension is specified.
public  ActionMappinggetMapping(HttpServletRequest request, ConfigurationManager configManager)
    
 StringgetUri(HttpServletRequest request)
    
public  StringgetUriFromActionMapping(ActionMapping mapping)
    
public  voidhandleSpecialParameters(HttpServletRequest request, ActionMapping mapping)
     Special parameters, as described in the class-level comment, are searched for and handled.
public  booleanisSlashesInActionNames()
    
 voidparseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager)
    
public  voidsetAllowDynamicMethodCalls(String allow)
    
public  voidsetAlwaysSelectFullNamespace(String val)
    
public  voidsetContainer(Container container)
    
public  voidsetExtensions(String extensions)
    
public  voidsetSlashesInActionNames(String allow)
    

Field Detail
ACTION_PREFIX
final static String ACTION_PREFIX(Code)



METHOD_PREFIX
final static String METHOD_PREFIX(Code)



REDIRECT_ACTION_PREFIX
final static String REDIRECT_ACTION_PREFIX(Code)



REDIRECT_PREFIX
final static String REDIRECT_PREFIX(Code)



extensions
List extensions(Code)




Constructor Detail
DefaultActionMapper
public DefaultActionMapper()(Code)




Method Detail
dropExtension
String dropExtension(String name)(Code)
Drops the extension from the action name
Parameters:
  name - The action name The action name without its extension



getDefaultExtension
String getDefaultExtension()(Code)
Returns null if no extension is specified.



getMapping
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager)(Code)



getUri
String getUri(HttpServletRequest request)(Code)
Gets the uri from the request
Parameters:
  request - The request The uri



getUriFromActionMapping
public String getUriFromActionMapping(ActionMapping mapping)(Code)



handleSpecialParameters
public void handleSpecialParameters(HttpServletRequest request, ActionMapping mapping)(Code)
Special parameters, as described in the class-level comment, are searched for and handled.
Parameters:
  request - The request
Parameters:
  mapping - The action mapping



isSlashesInActionNames
public boolean isSlashesInActionNames()(Code)



parseNameAndNamespace
void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager)(Code)
Parses the name and namespace from the uri
Parameters:
  uri - The uri
Parameters:
  mapping - The action mapping to populate



setAllowDynamicMethodCalls
public void setAllowDynamicMethodCalls(String allow)(Code)



setAlwaysSelectFullNamespace
public void setAlwaysSelectFullNamespace(String val)(Code)



setContainer
public void setContainer(Container container)(Code)



setExtensions
public void setExtensions(String extensions)(Code)



setSlashesInActionNames
public void setSlashesInActionNames(String allow)(Code)



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.