Running this in Jira 10 fails with nothing returned or rather the template rendering doesn’t seem to expand the $webResourceManager.getStaticPluginResource… part.
So guessing that there’s something that’s been moved around / replaced but hard to find the info in the sea of distributed info about Jira 10 and platform 7…
That might be related to the removal of deprecated methods of WebResourceManager which were replaced mostly with methods from WebResourceUrlProvider. You can find a replacement method in the UPGRADE guide Bitbucket.
I replaced the calls as described but at first it still failed.
The cause for this was that we in the old code (prior to Jira 10) called $webResourceManager#getStaticPluginResourceUrl(...) in the template file.
Simply replacing that with a call to $webResourceUrlProvider.getStaticPluginResourceUrl(...) in the template doesn’t work. So instead, I moved this into the Java code and add it to the context for the template renderer.
Voilà - up and running again!
So something like:
@Inject
public TheAppServlet(
...
@ComponentImport final TemplateRenderer templateRenderer,
@ComponentImport final WebResourceUrlProvider webResourceUrlProvider,
...) {
// <snip>
this.templateRenderer = templateRenderer;
this.webResourceUrlProvider = webResourceUrlProvider;
}
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
throws IOException, NumberFormatException {
<snip>
// Jira10 - Place our resources into the context here to make them available in the template:
String theAppJsPath =
webResourceUrlProvider.getStaticPluginResourceUrl("se.findout.plugin.dependency-map:javascript", "theAppFile.js", UrlMode.RELATIVE);
context.put("theAppJsPath", theAppJsPath);
templateRenderer.render("templates/theApp.vm", context, response.getWriter());
and then in theApp.vm just used the context variables: