Problem rendering restfull table

Dear community members

I am working on restful table by taking code content from ref app but not able to render restful table
following is my java class

package com.testcase.plugin.impl;

import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.plugin.webresource.WebResourceManager;
import com.atlassian.templaterenderer.TemplateRenderer;
import com.google.common.collect.ImmutableMap;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;


/**
 */
Scanned
Component
Named("RestfulTableServlet")
public class RestfulTableServlet extends HttpServlet {
	 ComponentImport
    private  WebResourceManager webResourceManager;
	 ComponentImport
    private  TemplateRenderer templateRenderer;
	 Inject
    public RestfulTableServlet(WebResourceManager webResourceManager,
                               TemplateRenderer templateRenderer) {
        this.webResourceManager = webResourceManager;
        this.templateRenderer = templateRenderer;
    }
    Override
    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        Map context = ImmutableMap.of("webResourceManager", webResourceManager);
        
        res.setContentType("text/html");
        render("restfultable/restfultable-example.vm", context, res.getWriter());
        includeResources();
        res.getWriter().close();
    }
    private void includeResources() {
        webResourceManager.requireResource("jira.webresources:jira-fields");
    }


    protected void render(String template, Map context, Writer output)
            throws IOException {
        templateRenderer.render(template, context, output);
    }
}

Following is the entry in my plugin.xml

	<!-- Restfultable configurations start -->

	<web-resource key="test-cycle-example">
		<resource type="download" name="test-cycle" location="restfultable/test-cycle.js" />
	</web-resource>
	<web-resource key="restfultable-example">
		<resource type="download" name="restfultable-example.js"
			location="restfultable/restfultable-example.js" />
	</web-resource>
	<web-resource key="test-page-resources-nosoy">
		<dependency>com.atlassian.auiplugin:aui-experimental-restfultable
		</dependency>
		<dependency>com.atlassian.auiplugin:ajs</dependency>
	</web-resource>
	<!-- Restfultable configurations END -->

and my vm file is

<!DOCTYPE html>
<html lang="en-au">
<head>
    <meta charset="utf-8">
    <title>AUI RestfulTable</title>
    <link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/6.0.7/css/aui-experimental.min.css" media="all">
    <script src="//aui-cdn.atlassian.com/aui-adg/6.0.7/js/aui-experimental.min.js"></script>
    <meta name="decorator" content="atl.general">
    $webResourceManager.requireResource("com.atlassian.auiplugin:ajs")
    $webResourceManager.requireResource("com.atlassian.auiplugin:aui-experimental-restfultable")
    $webResourceManager.requireResource("auiplugin-tests:restfultable-example")

</head>
<body>
<div id="message-area"></div>
<table id="contacts-table" class="aui"></table>


<table id="contacts-table-addPositionBottom" class="aui"></table>

</body>
</html>

Note removed @ symbol which are not allowing me to create issue :frowning:

1 Like