<commit_before>require('core.string');
import('helma.system', 'system');

system.addHostObject(org.helma.web.Request);
system.addHostObject(org.helma.web.Session);

var log = require('helma.logging').getLogger(__name__);

(function() {

    function cachedGetter(name, fn) {
        return function() {
            // make sure to never set anything on request prototype
            if (this != Request.prototype) {
                var cache = this.__property_cache__;
                if (!cache) {
                    cache = this.__property_cache__ = {};
                }
                if (!cache[name]) {
                    cache[name] = fn.apply(this);
                }
                return cache[name];
            }
        };
    }

    function ParameterGroup(path, map) {

        for (var i in map) {
            if (i.startsWith(path)) {
                var dot = i.indexOf('.', path.length);
                var key, value;
                if (dot > -1) {
                    key = i.slice(path.length, dot);
                    value = new ParameterGroup(i.slice(0, dot + 1), map);
                } else {
                    key = i.slice(path.length);
                    value = map[i];
                }
                if (!this.hasOwnProperty(key)) {
                    this[key] = value[0];
                }
            }
        }

        return this;
    }

    /**
     * Return true if this is a HTTP POST request.
     */
    this.isPost = function() {
        return this.method == "POST";
    }

    /**
     * Return true if this is a HTTP GET request.
     */
    this.isGet = function() {
        return this.method == "GET";
    }

    /* this.__defineGetter__("cookies", cachedGetter('cookies',
        function() {
            var cookies = {};
            for each (var cookie in this.getCookies()) {
                cookies[cookie.name] = cookie.value;
            }
            return cookies;
        })
    ); */

    /* this.__defineGetter__("params", cachedGetter('params', function() {
            return new ParameterGroup("", this.getParameterMap());
        })
    ); */

    this.__defineGetter__("data", cachedGetter('data', function() {
            return new ParameterGroup("", this.getParameterMap());
        })
    );
 
}).apply(Request.prototype);<commit_msg>Remove complex getter code - this stuff is now implemented in Java (ParameterMap)<commit_after>require('core.string');
import('helma.system', 'system');

system.addHostObject(org.helma.web.Request);
system.addHostObject(org.helma.web.Session);

var log = require('helma.logging').getLogger(__name__);

(function() {

    /**
     * Return true if this is a HTTP POST request.
     */
    this.isPost = function() {
        return this.method == "POST";
    }

    /**
     * Return true if this is a HTTP GET request.
     */
    this.isGet = function() {
        return this.method == "GET";
    }
 
}).apply(Request.prototype);
{'fraction_non_alphanumeric': 0.13724161301253812, 'fraction_numerical': 0.0013554727211114877, 'mean_word_length': 1.6836363636363636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3690042', 'n_tokens_mistral': 833, 'n_tokens_neox': 806, 'n_words': 185}