@Route("/{idea}/{file}", name="file", requirements={
"file"=".+"
}))
353161
public function fileAction($idea, $file)
    {
        $content = $this->getText($idea, $file); 
        if (!$content) {
            if ($caption = $this->checkTranslate($idea)) {
                return $this->redirectToRoute('file', [
                    'idea' => $caption,
                    'file' => $file
                ], 301); 
            }
            throw $this->createNotFoundException('Страница не найдена');
        } 
        $template = $file == 'index' ? 'index' : 'texts';
        return $this->render('RevolterIdealistBundle::'.$template.'.html.twig', [
            'title'    => $this->getTitle($content),
            'links'    => $this->getLinks($content),
            'pages'    => $this->getPages($content),
            'maintain' => $this->getMaintain(),
        ]);
    }
674587
function generate_routes(dir_name, controller, routes) {
	let route_def = cli.cat(dir_name + '/config/routes.js');
	let lines = [], line;
	let method, path, action;

	routes.forEach((route) => {
		// set parameters
		method = route.method; path = route.path;
		controller = route.controller; action = route.action;
		// create and add line
		line = `		this.${method}('${path}', '${controller}#${action}');`;
		lines.push(line);
	});
	// add lines to config file
	route_def = route_def.replace(/use\s?\(\)\s?{/, `use() {
${lines.join('\n')}${route_def.match(/use\s?\(\)\s?{\s*}/) ? '' : '\n'}`);
	fs.writeFileSync(dir_name + '/config/routes.js', route_def);
}
192786
function(file) {
        this.number++;

        var resource;
        var adapter = this.adapter;
        var resourceCache = adapter.resourceCache;
        var that = this;

        // ignore > map > normalize
        if (adapter.resourceIgnore(file)) {
            return Promise.resolve('');
        }
        file = adapter.resourceMap(file);
        file = this.normalize(file);

        if (this.number > this.adapter.resourceMaxNumber) {
            var errors = new Error('Exceed the maximum load limit on the number of resources');
            errors = new Resource.Error(errors, file);
            return Promise.reject(errors);
        }

        adapter.resourceBeforeLoad(file);

        if (resourceCache && this.cache[file]) {
            resource = this.cache[file];
            if (resource) {
                return resource;
            }
        }


        resource = new Promise(function(resolve, reject) {

            if (that.isRemoteFile(file)) {
                that.loadRemoteFile(file, onload);
            } else {
                that.loadLocalFile(file, onload);
            }

            function onload(errors, data) {
                if (errors) {
                    errors = new Resource.Error(errors, file);
                    reject(errors);
                } else {
                    resolve(data.toString());
                }
            }

        });


        if (resourceCache) {
            this.cache[file] = resource;
        }

        return resource;
    }
261734
function define(File, utils) {
  return class JSONFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Function} buildFactory
     *  - {Object} fileCache
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     *  - {String} webroot
     */
    constructor(id, filepath, options) {
      super(id, filepath, 'json', options);

      this.hasMaps = false;
      this.map = null;
      this.workflows.standard = WORKFLOW_STANDARD;
      // No processing required
      this.workflows.inlineable = [];
    }

    /**
     * Parse file contents for dependency references [no-op]
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    parse(buildOptions, fn) {
      debug(`parse: ${strong(this.relpath)}`, 4);
      fn();
    }
  };
}
697061
void fileWriteCheck(String filePath, AddOnModel addOnModel) {
        File request;
        try {
            request =  new File(filePath).getCanonicalFile();
        } catch (IOException e) {
            error("Error getting canonical path", e);
            throw getException(filePath);
        }

        isForbidden(request, addOnModel);

        boolean success = false;
        if (allowedWriteDirectories.stream()
                .anyMatch(compare -> request.toPath().startsWith(compare.toPath()))) {
            success = true;
        }

        for (String name : forbiddenWriteFilesNames) {
            if (request.getName().equals(name)) {
                success = false;
            }
        }

        if (!success) {
            throw getException(filePath);
        }

        if (!getSecurityManager().getSecureAccess().checkForExistingFileOrDirectory(request.toString())
                || getSecurityManager().getSecureAccess().checkForDirectory(request.toString())) {
            return;
        }
    }
894432
def join_file_uri(scheme, host, path, query)
      str = String.new("#{scheme}://")
      str << host if host
      path = "/#{path}" unless path.start_with?("/".freeze)
      str << URI::Generic::DEFAULT_PARSER.escape(path)
      str << "?#{query}" if query
      str
    end
609838
function (routerMiddelware, req, res, next) {
		var middlewareFilename = routerMiddelware.split('.')[0];
		var middlewareFunction = routerMiddelware.split('.')[1];

		if (!req.pipa) req.pipa = {};

		this.middlewares[middlewareFilename][middlewareFunction](req, res, function (data) {
			_.extend(req.pipa, data); next();
		});
	}
1215062
function addSingleRoute(verb, routePath, controllerName, actionName) {
		// add controller and action fields to the request
		var reqExtender = function(req, res, next) {
			req.controller = controllerName;
			req.action = actionName || 'index';
			next();
		};

		var params = [routePath, reqExtender];
		params = params.concat(getPolicies(controllerName, actionName));
		params.push(getAction(controllerName, actionName));

		app[verb].apply(app, params);
	}
1121739
function needStrucPermCreate(req, res, next) {
	( req.session.canCreate ) ? next() : res.redirect('/');
}
29942
function urlToRoutesFilePath (state, endpoint) {
  const [, scope] = endpoint.documentationUrl.match(/\/v3\/([^/#]+)((\/[^/#]+)*)/)
  return joinPath(
    __dirname,
    '..',
    'routes',
    state.folderName,
    kebabCase(scope),
    `${endpoint.idName}.json`
  )
}
388422
function(request, params, route) {
        var uRe         = params.url.split(/\//)
            , uRo       = route.split(/\//)
            , maxLen    = uRo.length
            , score     = 0
            , r         = {}
            , i         = 0;

        //attaching routing description for this request
        request.routing = params; // can be retried in controller with: req.routing

        if (uRe.length === uRo.length) {
            for (; i<maxLen; ++i) {
                if (uRe[i] === uRo[i]) {
                    ++score
                } else if (score == i && hasParams(uRo[i]) && fitsWithRequirements(request, uRo[i], uRe[i], params)) {
                    ++score
                }
            }
        }

        r.past = (score === maxLen) ? true : false;
        r.request = request;

        return r
    }
1293604
function addPath(immSet, urlObj, mode) {
    return immSet.add(
        mode === "snippet"
            ? urlObj.href
            : urlObj.path
    );
}
481383
def _serve_file(self, abspath, params):
    
    relpath = os.path.relpath(abspath, self._root)
    breadcrumbs = self._create_breadcrumbs(relpath)
    link_path = urlunparse(['', '', relpath, '', urlencode(params), ''])
    args = self._default_template_args('file.html')
    args.update({'root_parent': os.path.dirname(self._root),
                 'breadcrumbs': breadcrumbs,
                 'link_path': link_path})
    content = self._renderer.render_name('base.html', args).encode("utf-8")
    self._send_content(content, 'text/html')
77530
def attach_file_to_idea(self, filename, *args, **kwargs):
        
        kwargs.update({'file': {'attachment': open(filename, 'rb')}})
        return bind_api(
            api=self,
            path='/ideas/{ideaId}/attach',
            method='POST',
            payload_type='idea',
            allowed_param=['ideaId']
        )(*args, **kwargs)
3268
def get_route(self, file_id):

        ''' 
        '''

        title = '%s.get_route' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'file_id': file_id,
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # construct key word arguments
        request_kwargs = {
            'url': '%s/getFile' % self.api_endpoint,
            'data': {
                'file_id': file_id
            }
        }

    # send request
        response_details = self._post_request(**request_kwargs)

        return response_details
1372851
private File createFileNameFromRequest(HttpServletRequest pRequest) {
        //System.out.println("ServletPath" + pRequest.getServletPath());
        String path = pRequest.getServletPath();

        // Find last '/'
        int splitIndex = path.lastIndexOf("/");

        // Split -> path + name
        String name = path.substring(splitIndex + 1);
        path = path.substring(0, splitIndex);

        // Replace special chars in name with '_'
        name = name.replace('.', '_');
        String param = parameterName.replace('.', '_');
        param = param.replace('/', '_');
        param = param.replace('\\', '_');
        param = param.replace(':', '_');

        // tempfile = realPath(path) + name + "_oparam_" + number + ".jsp"
        int count = getOparamCountFromRequest(pRequest);

        // Hmm.. Would be great, but seems like I can't serve pages from within the temp dir
        //File temp = (File) getServletContext().getAttribute("javax.servlet.context.tempdir");
        //return new File(new File(temp, path), name + "_oparam_" + count + "_" + param + ".jsp");

        return new File(new File(pageContext.getServletContext().getRealPath(path)), name + "_oparam_" + count + "_" + param + ".jsp");
    }
260543
function doPost(path, data, callback) {
  var options = {
    host: GLOBAL.config.ESEARCH.server.host,
    port: GLOBAL.config.ESEARCH.server.port,
    path: GLOBAL.config.ESEARCH._index + path,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Content-Length': Buffer.byteLength(data)
    }
  };
  utils.doPostJson(options, data, callback);
}