How to generate a dynamic link for a button

Hello I have a web-item and I want to put there a dynamic link based on the old url. I registered a web-item and a context-provider in my atlassian-plugin.xml file. However, Jira doesn’t accept my Contentprovider. How can I solve this issue?

Atlassian-plugin.xml:

Contentprovier.init():

logger.info(“invoked contextprovider::init()”);
Map<String, Object> myContextMap = new HashMap<>(arg0);
HttpServletRequest request = ExecutingHttpRequest.get();
// ComponentAccessor.getIssueManager().getIssueObject(issue.id)
if(request==null) return;
String oldUrl = request.getRequestURL().toString();
String queryString = request.getQueryString();
logger.info(“Old URL: {}”, oldUrl);
logger.info(“Query String: {}”, queryString);
if(!queryString.contains(“Bedarfsanforderung”)) return;
String newUrl = oldUrl + “/newgen/” + queryString;
myContextMap.put(“new-gen-link-variabel”, newUrl);
logger.info(“New URL: {}”, newUrl);

template:

#if ($new-gen-link-variabel)
<*a href=“$new-gen-link-variabel” class=“aui-button aui-button-primary”>AANF Neugenerierung
#else
<*a href=“/fallback/link” class=“aui-button aui-button-primary”>AANF Neugenerierung
#end