<commit_before>/*******************************************************************************
 * @license
 * Copyright (c) 2012 VMware, Inc. All Rights Reserved.
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 * You can obtain a current copy of the Eclipse Public License from
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * Contributors:
 *     <NAME>
 *     <NAME>
 *     <NAME>
 *     <NAME>
 *     <NAME>
 ******************************************************************************/

function configure(filesystem) {

	var express = require('express');
	var pathResolve = require('path').resolve;

	function start(route, handle) {
		function onRequest(req, res, next) {
			var path = req.path;
			// Don't bother for favicon.ico
			if (path === '/favicon.ico') {
	            res.writeHead(404, {
	                "Content-Type": "text/html"
	            });
	            res.write("404 Not found");
	            res.end();
				return;
			}
			//console.log("Request for " + path + " received.");
			route(handle, path, res, req, next);
		}

		var app = express();
		//This weirdness below is because of
		//https://github.com/sockjs/sockjs-node/issues/78
		//So we need to allow socket servlet access to the
		//naked nodejs http server to workarond.
		app.server = require('http').createServer(app);

		app.configure(function() {
			app.use(express.json());
			app.use(app.router);
			app.use(onRequest); // bridge to 'servlets', we should remove over time
			app.use(express['static'](pathResolve(__dirname, '../client')), { maxAge: 6e5 });
			app.use(express.errorHandler({
				dumpExceptions: true,
				showStack: true
			}));
		});

		require('./servlets/status').install(app);

		require('./routes/editor-routes').install(app, filesystem);
		require('./routes/test-routes').install(app);
		require('./routes/config-routes').install(app);
		require('./routes/plugin-routes').install(app);

		require('./servlets/incremental-search-servlet').install(app);
		require('./servlets/incremental-file-search-servlet').install(app, filesystem);

		require('./servlets/application-servlet').install(app);

		console.log('app.server = ' + app.server);
		app.server.listen(7261, "127.0.0.1" /* only accepting connections from localhost */);
		console.log("Server has started.");
	}
<commit_msg>put cache life in the right place<commit_after>/*******************************************************************************
 * @license
 * Copyright (c) 2012 VMware, Inc. All Rights Reserved.
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 * You can obtain a current copy of the Eclipse Public License from
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * Contributors:
 *     <NAME>
 *     <NAME>
 *     <NAME>
 *     <NAME>
 *     <NAME>
 ******************************************************************************/

function configure(filesystem) {

	var express = require('express');
	var pathResolve = require('path').resolve;

	function start(route, handle) {
		function onRequest(req, res, next) {
			var path = req.path;
			// Don't bother for favicon.ico
			if (path === '/favicon.ico') {
	            res.writeHead(404, {
	                "Content-Type": "text/html"
	            });
	            res.write("404 Not found");
	            res.end();
				return;
			}
			//console.log("Request for " + path + " received.");
			route(handle, path, res, req, next);
		}

		var app = express();
		//This weirdness below is because of
		//https://github.com/sockjs/sockjs-node/issues/78
		//So we need to allow socket servlet access to the
		//naked nodejs http server to workarond.
		app.server = require('http').createServer(app);

		app.configure(function() {
			app.use(express.json());
			app.use(app.router);
			app.use(onRequest); // bridge to 'servlets', we should remove over time
			app.use(express['static'](pathResolve(__dirname, '../client'), { maxAge: 6e5 }));
			app.use(express.errorHandler({
				dumpExceptions: true,
				showStack: true
			}));
		});

		require('./servlets/status').install(app);

		require('./routes/editor-routes').install(app, filesystem);
		require('./routes/test-routes').install(app);
		require('./routes/config-routes').install(app);
		require('./routes/plugin-routes').install(app);

		require('./servlets/incremental-search-servlet').install(app);
		require('./servlets/incremental-file-search-servlet').install(app, filesystem);

		require('./servlets/application-servlet').install(app);

		console.log('app.server = ' + app.server);
		app.server.listen(7261, "127.0.0.1" /* only accepting connections from localhost */);
		console.log("Server has started.");
	}

{'fraction_non_alphanumeric': 0.21353322528363047, 'fraction_numerical': 0.01053484602917342, 'mean_word_length': 3.5335169880624426, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '1727630', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1440, 'n_words': 344}