Quantcast
Channel: Active questions tagged atlassian-plugin-sdk - Stack Overflow
Viewing all articles
Browse latest Browse all 279

REST endpoint working fine for in line script but failing when using script editor

$
0
0

I am using a REST endpoint in scriptrunner and here is the code that I am using. The code is working fine when using an in line script but fails when specifying the file in scriptrunner where the code lies as shown in the following picture: 

enter image description here

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegateimport groovy.transform.BaseScriptimport com.atlassian.jira.issue.Issue;import javax.ws.rs.core.MultivaluedMapimport javax.ws.rs.core.Responseimport com.atlassian.jira.component.ComponentAccessorimport org.apache.log4j.Loggerimport com.atlassian.jira.project.Projectimport CreateMultipleSubtasks.Configuration_CreateMultipleSubtasks@BaseScript CustomEndpointDelegate delegatecallSubTaskCreator(httpMethod: "GET", groups: ["jira-users"]) {MultivaluedMap queryParams, String body ->def log1 = Logger.getLogger("atlassian-jira.log")log1.warn("MOUNA CAMELIA223"); Configuration_CreateMultipleSubtasks conf =new Configuration_CreateMultipleSubtasks()def MultipleSubtasksHashMap= conf.getSubTaskCreatorHashMap()String itracCreatemultiplesubtasksProjectCategoriesURL = MultipleSubtasksHashMap["itracCreatemultiplesubtasksProjectCategoriesURL"] as String;// String itracCreatemultiplesubtasksProjectCategoriesURL= "http://itrac-sustservice.eur.ad.sag:5555/web/subtaskmgr/Login.jsp?iTrac=:1:&reporter=:2:"log1.warn("MOUNA CAMELIA223 "+itracCreatemultiplesubtasksProjectCategoriesURL);  def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser  def issueId = queryParams.getFirst("issueId") as Long  Issue myissue = ComponentAccessor.getIssueManager().getIssueObject(issueId)  def issueKey = myissue.getKey()  def itracCreatemultiplesubtasksProjectCategoriesURL2 = itracCreatemultiplesubtasksProjectCategoriesURL.replaceAll(":1:", issueKey)  def itracCreatemultiplesubtasksProjectCategoriesURL3 = itracCreatemultiplesubtasksProjectCategoriesURL2.replaceAll(":2:", user.getUsername())  log1.warn("The rest endpoint has been executed by the user " +user)  Response.temporaryRedirect(URI.create(itracCreatemultiplesubtasksProjectCategoriesURL3)).build() }

This is what I get when I move the code into a file in the script editor. I am normally supposed to click on a button and move to a new page and this is what I get instead:enter image description here

Anyone knows what needs to be changed and how this can be fixed?


Viewing all articles
Browse latest Browse all 279

Trending Articles