This page last changed on Oct 09, 2008 by jeff.

Webwork Actions and actions.xml

JIRA uses the Webwork (1.x) framework to define MVC mappings. This has been superseded by Webwork 2 which is used by Confluence, Bamboo and Crowd. The best source of documentation is: http://opensymphony.com/webwork_old/src/docs/manual/ and http://wiki.opensymphony.com/display/WW1/Home

The mappings are declared in the actions.xml file (src/webapp/WEB-INF/classes/actions.xml).

Note the parts of the action mapping.

Commands are optional, you use them when several interactions belong to the same Action. A command name is specified on the url like this:

SomeAction!myCommand.jspa

The command is implemented in a method in the Action class with the corresponding name:

public String doMyCommand() {

    // implement the command logic here

    return "someview";
}

The doExecute method is run when no command is requested i.e. the bare /path/to/MyAction.jspa.

Security

When adding an action to the actions.xml You must ensure the appropriate roles-required value is specified. This will ensure only users in the authorised role can execute the action. For actions that can be handled by application level security, such as those actions that can be given to project administrators identified through the course of administering JIRA, no role may be required, likewise setup actions and others that manage their own permissions. For some actions, the use role must be present. This ensures the user is logged in and identified.

The admin role is required for all administration actions so you must be sure when adding an action that your new action has roles-required="admin" or confident that it doesn't need it. The sysadmin role requires the user be a system administrator, and the use role requires that they just be logged in. (Other definitions can be found in Permissions.java in the source).

Actions don't care about the path of the URI, just the ActionName.jspa and optionally the !commandName suffix.

Webwork Plugins

JIRA can have Actions defined in plugins.


actions.xml.png (image/png)
Document generated by Confluence on Oct 06, 2009 00:31