The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Path File web resource

gia01020304
February 17, 2019

 I have build jira plugin rest

I add file xml in resource>config>myfile.xml in my project

I add in atlassian-plugin.xml

<resource type="download" name="myfile.xml" location="/config/myfile.xml"/>

And in my file rest.java I don't know how to get the file path

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
gia01020304
February 25, 2019

I had resolved my problem by 

InputStream isStream = getClass().getResourceAsStream("filename");

After that use function

 

 public Document readFileXmlDeploy(InputStream is) throws Exception {
Document document = null;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder;
try {
documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.parse(is);
} catch (Exception e) {
throw e;
}
return document;
}