<commit_before>package com.eae

import org.codehaus.groovy.grails.web.json.JSONObject

class SparkSubmitController {

    def sparkSubmitService


    static allowedMethods = [runSubmit:'POST']

    def runSubmit = {
        final String scriptDir = getWebAppFolder() + '/Scripts/';
        response.setContentType("application/json");

        println( request.reader)
        println(request.reader.text)

        def out = new JSONObject(request.reader.text)
        println(out)
        JSONObject myParams = new JSONObject(response.toString())

        String workflow = myParams.workflow;
        String dataFileName = myParams.dataFileName;
        String additionalFileName = myParams.additionalFileName
        def workflowSpecificParameters = myParams.workflowSpecificParameters; // sparkSubmitService.prepareSpecificParameters(params)
        def mongoDocumentID = myParams.mongoDocumentID;

        sparkSubmitService.sparkSubmit(scriptDir, workflow, dataFileName, additionalFileName, workflowSpecificParameters, mongoDocumentID)

        render workflow
    }


    /**
     *   Gets the directory where all the R scripts are located
     *
     *   @return {str}: path to the script folder
     */
    def getWebAppFolder() {
        return request.getSession().getServletContext().getRealPath("")
    }

}<commit_msg>I hope working version of POST....<commit_after>package com.eae
import grails.converters.JSON

class SparkSubmitController {

    def sparkSubmitService


    static allowedMethods = [runSubmit:'POST']

    def runSubmit = {
        final String scriptDir = getWebAppFolder() + '/Scripts/';
        response.setContentType("application/json");

        println(request.reader.text )

        def myParams =  request.reader.text as JSON
        println(out)

        String workflow = myParams.workflow;
        String dataFileName = myParams.dataFileName;
        String additionalFileName = myParams.additionalFileName
        def workflowSpecificParameters = myParams.workflowSpecificParameters; // sparkSubmitService.prepareSpecificParameters(params)
        def mongoDocumentID = myParams.mongoDocumentID;

        sparkSubmitService.sparkSubmit(scriptDir, workflow, dataFileName, additionalFileName, workflowSpecificParameters, mongoDocumentID)

        render "OK"
    }


    /**
     *   Gets the directory where all the R scripts are located
     *
     *   @return {str}: path to the script folder
     */
    def getWebAppFolder() {
        return request.getSession().getServletContext().getRealPath("")
    }

}
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.0, 'mean_word_length': 3.171288743882545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2766573', 'n_tokens_mistral': 687, 'n_tokens_neox': 635, 'n_words': 152}