Hi,
I have a application code converted to Jar(developed in Spring). This Jar when called using Jira credentials and ticket, will prepare and return a document having ticket details and is downloadable. From my local it is working fine and i am able to download document.
When i try to do this from Workflow postfunctions(Using Scriptrunner), I am not able to return browser downloadable document.
Jar is placed in Jira Server which is executable and in workflow postfunctions script is placed to call jar file to generate and download document.
From Logs, word document is generated in server, but i am not able to return response to browser. Could you please help on this?
import java.net.http.HttpResponse;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
//def myIssue = event.issue
String myIssueKey = issue.getKey()
log.error("DeliveryID:"+ myIssueKey)
log.error(issue)
String user="user"
log.error("Username"+ user)
String pass="password"
log.error("Password"+ pass)
//CloseableHttpClient client = HttpClients.createDefault();
try{
String URL="http://Jira Server IP:8090/server-Jar-path/Username/Password/Ticket-number";
URL url = new URL(URL);
log.error("Conn IN")
HttpURLConnection con = (HttpURLConnection) url.openConnection();
log.error("Open connection"+con)
con.setRequestMethod("GET");
String contentType = con.getHeaderField("Content-Type");
log.error("Content type"+contentType)
log.error("Get Method In")
con.setDoOutput(true);
log.error("getcontentmethod"+con.getRequestMethod())
con.connect();
OutputStream out = con.getOutputStream();
log.error("Output stream " +out)
log.error("Response" +con.getResponseCode())
out.write("".getBytes());
out.flush();
con.disconnect();
log.error("Disconnect")
//client.close();
log.error("Close")
Response.ok(out).build();
log.error("Completed")
} catch (Exception e){
log.error(e);
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.