Rate this page:
Atlassian Plugin Framework 3.0 and later.
To achieve this, we have created new APIs for web-resource transforms and conditions. This page describes how to update your transforms and conditions to these new APIs.
Under the new APIs, all the information required by the transformer or condition must be encoded in the URL. Do not assume that you will have a current user at resource-serve-time. To achieve this, we have deprecated the old web-resource transform and condition APIs and created new APIs:
These APIs appear in version 3.0.
There are two cases to fix here:
Examples include LESS and i18n transformation.
To fix these, convert from to WebResourceTransformerFactory (which produces ). This enables you to contribute to the URL at page-render-time and read from that URL at resource-serve-time.
Taking the i18n transform as an example:
Note that fixing the transform can be hard, as it may not be the transform class that is actually doing the cookie lookup; it may be something deeper in the dependency-injection hierarchy. For this reason, it is better to convert to the data API if possible (see below).
To see this in action, see the new ContextPathProvider. This consists of three parts:
When looking at conditions, the first thing to consider is:
If you do need to convert it, the most common solution is to convert your conditions to a UrlReadingCondition.
Note one potential issue:
If your plugin targets products using old versions of webresources but you want to make use of the transform2 / condition2, use the following techniques to be compatible:
Keep your transform1 implementation untouched and add a transform2 declaration with = the key of the transform1.
The transform lookup algorithm for a key is as follows:
<!-- in a plugin using the transform --> <web-resource key="my-resource"> <transformation extension="js"> <transformer key="jsI18n" /> </transformation> ...
will be ignored.
Add a attribute to your declaration:
<web-resource key="my-resource"> <condition class="com.atlassian.jira.plugin.webfragment.conditions.BooleanSystemPropertyCondition" class2="com.atlassian.jira.plugin.webfragment.conditions.UrlReadingBooleanSystemPropertyCondition"> <param name="property">jira.dev.mode</param> </condition> </web-resource>
In an old product, will be ignored.
In a new product, for a only (ie not a / etc), the contract is to look for if it exists, otherwise use .
Note that can be either a condition1 or a condition2 - in particular if you're implementing something for condition2 only, can be a condition2.
Rate this page: