This page last changed on Oct 05, 2009 by rosie@atlassian.com.

A webwork plugin module defines a URL-addressible 'action', allowing JIRA's user-visible functionality to be extended or partially overridden.

Here is a sample webwork plugin module:

    <webwork1 key="HelloWorld_key" name="My Hello World action" class="java.lang.Object">
        <actions>
            <action name="HelloWorldAction" alias="Hello">
                <view name="success">/templates/helloworld.vm</view>
            </action>
        </actions>
    </webwork1>

Where:

  • HelloWorld_key is any uniquely identifying key
  • My Hello World action is a user-friendly module description (displays in the plugins admin section)
  • Action name HelloWorldAction is a class name, relative to a package specified in WEB-INF/classes/webwork.properties:

    webwork.action.packages=webwork.action.standard, com.atlassian.jira.web.action

    For example, the class could be com/atlassian/jira/web/action/HelloWorldAction.java.

  • Action alias Hello is the URL which this action can be invoked from, relative to /secure, eg. http://localhost:8080/jira/secure/Hello.jspa
  • /templates/helloworld.vm is the template (here, velocity) which will render the HTML which the user sees, displaying information fetched by running methods on the action class (HelloWorldAction). It is not possible ot include a *.jsp file within the plugin jar, only Velocity files. If you wish to use a jsp, you must add it into the webapps directory or with the JIRA itself.

Webwork plugins effectively extend the actions defined in JIRA's main WEB-INF/classes/actions.xml file. You should look there for examples on what is possible.

Examples

By specifying as 'alias' the name of an existing action (in actions.xml), you can override default JIRA behaviour. For example, to override the Administrators.jspa action (the 'Contact Administrators' link at the bottom of every page):

    <webwork1 key="ASFAdministrators" name="Lists project leads on administrators page" class="java.lang.Object">
        <actions>
            <action name="ASFAdministrators" alias="Administrators">
                <view name="success">/templates/asf_administrators.vm</view>
            </action>
        </actions>
    </webwork1>

See the full sample plugin

See also the Copyright information for attachments page for another example of overriding a default JIRA action.

Notes

When writing a Plugins2 plugin, please note that your plugin must not contain any classes in packages that also exist in JIRA. You will need to put your action classes in a plugin-specific directory and explicitly define the full class name in your atlassian-plugin.xml, e.g;:

<webwork1 key="bambooServerConfig" name="Configure Your Bamboo Server">
        <actions>
            <action name="com.atlassian.jira.plugin.ext.bamboo.web.ViewBambooServers" alias="ViewBambooServers">
                <view name="success">/templates/plugins/bamboo/viewServers.vm</view>
            </action>
        </actions>
    </webwork1>
Document generated by Confluence on Oct 06, 2009 00:31