Forums

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

How can I send parameters from REST file to the velocity?

Ashish Biswal April 9, 2019

I want to have the response and few parameters passed to the velocity from the REST file

1 answer

0 votes
Nir Haimov
Community Champion
April 10, 2019

Hi,

You can follow this documentation:
https://developer.atlassian.com/server/jira/platform/adding-content-to-the-jira-view-issue-page/

Alternative way, here is an example:

@Scanned
public class MyClass extends HttpServlet {
...
...
...
@ComponentImport
private final TemplateRenderer renderer;
@ComponentImport
private final PluginSettingsFactory pluginSettingsFactory;

@Inject
public ReleaseManagerServlet(TemplateRenderer renderer,PluginSettingsFactory pluginSettingsFactory)
{
this.renderer = renderer;
this.pluginSettingsFactory = pluginSettingsFactory;
}

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

HashMap<String, Object> context = new HashMap<String, Object>();
context.put("myParam", "my value"));
response.setContentType("text/html;charset=utf-8");
renderer.render("velocity/myVelocity.vm", context ,response.getWriter());
}

Suggest an answer

Log in or Sign up to answer