Export java variable from java side to js web(use reactjs) page side

Hello,

I have to develop a sonarqube plugin which takes care of adding a web page to the platform which will display data that I am able to recover in the project to be analyzed using a sensor. The problem that I have is how to transmit this data retrieved from the java side with the sensor to the javascript side and finally display it on my page.

Thank you for help.

public class MySensor implements Sensor {

        private static final Logger LOGGER = Loggers.get(MySensor.class);

        private static final String[] DEFAULT_PATHS = {"target/report.json"};
        static final String REPORT_PATHS_PROPERTY_KEY = "sonar.jsonReportPaths";

        public static JsonArray JSON_ARRAY;

        @Override
        public void describe(SensorDescriptor descriptor) {
                descriptor.name(" JSON Report Importer");

        }

        @Override
        public void execute(SensorContext context) {
                ReportPathsProvider reportPathsProvider = new ReportPathsProvider(context);
                //Iterable<InputFile> inputFiles = context.fileSystem().inputFiles(context.fileSystem().predicates().all());


                importReports(reportPathsProvider);
        }

        void importReports(ReportPathsProvider reportPathsProvider) {
            Collection<Path> reportPaths = reportPathsProvider.getPaths(DEFAULT_PATHS,REPORT_PATHS_PROPERTY_KEY);
            if (reportPaths.isEmpty()) {
              LOGGER.info("No report imported, no coverage information will be imported by JSON Report Importer");
              return;
            }

            for(Path reportPath : reportPaths) {
                LOGGER.info("Reading report '{}'",reportPath);
                File file = reportPath.toFile();
                        try {
                    // Create JsonReader from Json.
                    JsonReader reader = Json.createReader(new FileInputStream(file));
                    // Get the JsonArray structure from JsonReader.
                    JSON_ARRAY = reader.readArray();
                    reader.close();
                    LOGGER.info("FILE '{}' content  ==> \n '{}'",reportPath, JSON_ARRAY.toString());


                        } catch (FileNotFoundException e) {
                                e.printStackTrace();
                        }
            }

here my sensor i need te get JSON_ARRAY in my java side to desplay it in my web page extension.

Any idea??