Forums

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

How to embed Velocity Template inside Atlassian UI using REST module

Vijay Patil July 18, 2018

I have created a JIRA plugin and added REST module. Now I am calling velocity template using REST module, like this -

@GET
@Path("/login")
@AnonymousAllowed
@Produces({ MediaType.TEXT_HTML })
public Response getLoginPage(@PathParam("projectId") final String projectId) {
        
    try {
        Map<String, Object> context = new HashMap<>();
     context.put("loginUri", loginUri);

        httpServletResponse.setContentType("text/html;charset=utf-8");
     templateRenderer.render("/templates/login.vm", context, httpServletResponse.getWriter());
    } catch (Exception e) {
     throw new WebApplicationException(e);
    }
        
    return Response.ok().build();
}

The velocity template looks like this -

<html>
<head>
<title>Login</title>
<meta name="decorator" content="atl.admin" />
<script>/*javascript code*/</script>
</head>
<body>
/*Login UI*/
</body>
</html>

But the login UI is not getting embedded inside Atlassian UI. It is getting rendered as a separate HTML file. It works fine with Servlet module, but doesn't work same with REST module.

How can I render Velocity Template inside Atlassian UI from REST module ?

0 answers

Suggest an answer

Log in or Sign up to answer