Maps a route namespace with the given params and point it's requests to the especified controller.
        :param route: str Namespace route to be mapped
        :param controller: callback Controller callable to map end-points
        :rtype: url
19589
def mount(self, route: str, controller: callable) -> url:
        
        if issubclass(controller, TemplateView):
            return url(
                r"%s" % route,
                Router(self, route, controller).handle
            )
        else:
            raise TypeError("The controller %s must be a subclass of %s" % (
                    controller, TemplateView
                )
            )
367416
def _generate_routes(self, namespace):
        

        # Hack: needed for _docf()
        self.cur_namespace = namespace
        # list of auth_types supported in this base class.
        # this is passed with the new -w flag
        if self.args.auth_type is not None:
            self.supported_auth_types = [auth_type.strip().lower() for auth_type in self.args.auth_type.split(',')]

        check_route_name_conflict(namespace)

        for route in namespace.routes:
            # compatibility mode : included routes are passed by whitelist
            # actual auth attr inluded in the route is ignored in this mode.
            if self.supported_auth_types is None:
                self._generate_route_helper(namespace, route)
                if route.attrs.get('style') == 'download':
                    self._generate_route_helper(namespace, route, True)
            else:
                route_auth_attr = None
                if route.attrs is not None:
                    route_auth_attr = route.attrs.get('auth')
                if route_auth_attr is None:
                    continue
                route_auth_modes = [mode.strip().lower() for mode in route_auth_attr.split(',')]
                for base_auth_type in self.supported_auth_types:
                    if base_auth_type in route_auth_modes:
                        self._generate_route_helper(namespace, route)
                        if route.attrs.get('style') == 'download':
                            self._generate_route_helper(namespace, route, True)
                        break
1280995
def request_matches_route(self, actual_route: str, expected_route: str):
        
        expected_params = self.get_url_params(expected_route)
        actual_params = self.get_url_params(actual_route)
        i = 0

        if len(expected_params) == len(actual_params):
            for param in actual_params:
                if expected_params[i][0] != "{":
                    if param != expected_params[i]:
                        return False
                i += 1
        else:
            return False

        return True
1149864
def add_route(self, template, controller, **kwargs):
        
        if isinstance(controller, basestring):
            controller = pymagic.import_name(controller)

        self.routes.append((self.parse_route(template), controller, kwargs))

        return self
1316219
def find_matching_endpoints(self, swagger_ns):
        
        def match_func(operation, ns, rule):
            # only expose endpoints that have the correct path prefix and operation
            return (
                rule.rule.startswith(self.graph.build_route_path(swagger_ns.path, swagger_ns.prefix)) and
                operation in self.matching_operations
            )

        return list(iter_endpoints(self.graph, match_func))
1033098
def __set_route(self, type_route, route):
        
        if type_route in self.__routes:
            if not self.verify_route_already_bound(type_route, route):
                self.__routes[type_route].append(route)
        else:
            self.__routes[type_route] = [route]
        return RouteMapping
807868
def options(self, route: str(), callback: object()):
        
        self.__set_route('options', {route: callback})
        return RouteMapping
1334180
@SuppressWarnings("unchecked")
    private List<Route> createControllerRoutes(Map<Method, Class<? extends Annotation>> controllerMethods) {
        List<Route> routes = new ArrayList<>();

        Class<? extends Controller> controllerClass = (Class<? extends Controller>) controllerMethods.keySet().iterator().next().getDeclaringClass();
        Set<String> controllerPaths = getControllerPaths(controllerClass);
        Collection<Method> methods = sortControllerMethods(controllerMethods.keySet());
        for (Method method : methods) {
            Class<? extends Annotation> httpMethodAnnotationClass = controllerMethods.get(method);
            Annotation httpMethodAnnotation = method.getAnnotation(httpMethodAnnotationClass);

            String httpMethod = httpMethodAnnotation.annotationType().getAnnotation(HttpMethod.class).value();
            String[] methodPaths = ClassUtils.executeDeclaredMethod(httpMethodAnnotation, "value");

            if (controllerPaths.isEmpty()) {
                // add an empty string to allow controllerPaths iteration
                controllerPaths.add("");
            }

            for (String controllerPath : controllerPaths) {
                if (methodPaths.length == 0) {
                    // controllerMethod does not specify a path, inherit from controller
                    String fullPath = StringUtils.addStart(controllerPath, "/");

                    // create the route handler
                    RouteHandler handler = new ControllerHandler(application, method);

                    // create the route
                    Route route = new Route(httpMethod, fullPath, handler)
                        .bind("__controllerClass", controllerClass)
                        .bind("__controllerMethod", method);

                    // add the route to the list of routes
                    routes.add(route);
                } else {
                    // controllerMethod specifies one or more paths, concatenate with controller paths
                    for (String methodPath : methodPaths) {
                        String path = Stream.of(StringUtils.removeEnd(controllerPath, "/"), StringUtils.removeStart(methodPath, "/"))
                            .filter(Objects::nonNull)
                            .collect(Collectors.joining("/"));
                        String fullPath = StringUtils.addStart(path, "/");

                        // create the route handler
                        RouteHandler handler = new ControllerHandler(application, method);

                        // create the route
                        Route route = new Route(httpMethod, fullPath, handler)
                            .bind("__controllerClass", controllerClass)
                            .bind("__controllerMethod", method);

                        // add the route to the list of routes
                        routes.add(route);
                    }
                }
            }
        }

        return routes;
    }
713849
def app_routes(app):
    
    _routes = []
    for rule in app.url_map.iter_rules():
        _routes.append({
            'path': rule.rule,
            'name': rule.endpoint,
            'methods': list(rule.methods)
        })
    return jsonify({'routes': _routes})
131203
def _add_url_route(self, endpoint, rule, view_func, method):
        
        if self.api_prefix:
            rule = self.api_prefix + rule

        if self.endpoint_prefix:
            endpoint = self.endpoint_prefix + endpoint

        self.app.add_url_rule(
            rule,
            endpoint,
            self._apply_auth(view_func),
            methods=[method]
        )
596743
function(controller, routeOptions) {
      return function(req, res, next) {
        var requiredParams = routeOptions.requiredParams || [];
        var ignoredParams = routeOptions.ignoredParams || [];

        // Omit disallowed params in body and query
        if (ignoredParams.length) {
          req.body = _.omit(req.body, ignoredParams);
          req.query = _.omit(req.query, ignoredParams);
        }

        // Reject request if required params are missing
        if (requiredParams.length) {
          // Find all missing parameters
          // If there are missing parameters,
          // respond with an error before routing
          var missingParams = router._buildMissingParams(req, requiredParams);
          if (missingParams.length) {
            return next(router._buildMissingParamsError(missingParams));
          }
        }

        // Execute the route for the request
        return routeOptions.action.call(controller, req, res, next);
      };
    }
1352226
def _generate_routes_h(self, namespace):
        """"""
        self.emit(comment_prefix)
        self.emit_wrapped_text(
            'Routes for the `{}` namespace'.format(fmt_class(namespace.name)),
            prefix=comment_prefix)
        self.emit(comment_prefix)

        self.emit()
        self.emit('NS_ASSUME_NONNULL_BEGIN')
        self.emit()

        with self.block_h(
                fmt_routes_class(namespace.name, self.args.auth_type)):
            description_str = (
                'An instance of the networking client that each '
                'route will use to submit a request.')
            self.emit_wrapped_text(description_str, prefix=comment_prefix)
            self.emit(
                fmt_property_str(
                    prop='client',
                    typ='id<{}>'.format(
                        self.args.transport_client_name)))
            self.emit()

            routes_obj_args = fmt_func_args_declaration(
                [('client',
                  'id<{}>'.format(self.args.transport_client_name))])

            init_signature = fmt_signature(
                func='init',
                args=routes_obj_args,
                return_type='instancetype')
            description_str = (
                'Initializes the `{}` namespace container object '
                'with a networking client.')
            self.emit_wrapped_text(
                description_str.format(
                    fmt_routes_class(namespace.name, self.args.auth_type)),
                prefix=comment_prefix)
            self.emit('{};'.format(init_signature))
            self.emit()

            style_to_request = json.loads(self.args.z__style_to_request)

            for route in namespace.routes:
                if (route.attrs.get('auth') != self.args.auth_type
                        and route.attrs.get('auth') != 'noauth'):
                    continue

                route_type = route.attrs.get('style')
                client_args = json.loads(self.args.client_args)

                if route_type in client_args.keys():
                    for args_data in client_args[route_type]:
                        task_type_key, type_data_dict = tuple(args_data)
                        task_type_name = style_to_request[task_type_key]

                        func_suffix = type_data_dict[0]
                        extra_args = [
                            tuple(type_data[:-1])
                            for type_data in type_data_dict[1]
                        ]
                        extra_docs = [(type_data[0], type_data[-1])
                                      for type_data in type_data_dict[1]]

                        if (is_struct_type(route.arg_data_type) and
                                self._struct_has_defaults(route.arg_data_type)):
                            route_args, doc_list = self._get_default_route_args(
                                namespace, route, tag=True)
                            self._generate_route_signature(
                                route, namespace, route_args, extra_args,
                                doc_list + extra_docs, task_type_name,
                                func_suffix)

                        route_args, doc_list = self._get_route_args(
                            namespace, route, tag=True)
                        self._generate_route_signature(
                            route, namespace, route_args, extra_args,
                            doc_list + extra_docs, task_type_name, func_suffix)
                else:
                    task_type_name = style_to_request[route_type]
                    if (is_struct_type(route.arg_data_type) and
                            self._struct_has_defaults(route.arg_data_type)):
                        route_args, doc_list = self._get_default_route_args(
                            namespace, route, tag=True)
                        self._generate_route_signature(
                            route, namespace, route_args, [], doc_list,
                            task_type_name, '')

                    route_args, doc_list = self._get_route_args(
                        namespace, route, tag=True)
                    self._generate_route_signature(route, namespace,
                                                   route_args, [], doc_list,
                                                   task_type_name, '')
        self.emit()
        self.emit('NS_ASSUME_NONNULL_END')
        self.emit()
381457
def execute(self, slave_id, route_map):
        
        for index, value in enumerate(self.values):
            address = self.starting_address + index
            endpoint = route_map.match(slave_id, self.function_code, address)

            try:
                endpoint(slave_id=slave_id, address=address, value=value,
                         function_code=self.function_code)
            # route_map.match() returns None if no match is found. Calling None
            # results in TypeError.
            except TypeError:
                raise IllegalDataAddressError()
1206824
protected function mapRoute(): Controller
    {
        foreach ($this->routes['get'] as $pattern => $func) {
            $this->mapStaticRoutes($pattern, $func);
        }

        foreach ($this->routes['post'] as $pattern => $func) {
            $this->mapStaticRoutes($pattern, $func, 'post');
        }

        return $this;
    }
659541
def _get_route_info(self, request):
        """"""
        resolve_match = resolve(request.path)

        app_name = resolve_match.app_name    # The application namespace for the URL pattern that matches the URL.
        namespace = resolve_match.namespace  # The instance namespace for the URL pattern that matches the URL.
        url_name = resolve_match.url_name    # The name of the URL pattern that matches the URL.
        view_name = resolve_match.view_name  # Name of the view that matches the URL, incl. namespace if there's one.

        return {
            "app_name": app_name or None,
            "namespace": namespace or None,
            "url_name": url_name or None,
            "view_name": view_name or None,
        }
1238895
function(route, name, callback) 
	{
		var regExp = conbo.isRegExp(route) ? route : this.__routeToRegExp(route);
		
		if (!callback) 
		{
			callback = this[name];
		}
		
		if (conbo.isFunction(name)) 
		{
			callback = name;
			name = '';
		}
		
		if (!callback) 
		{
			callback = this[name];
		}
		
		this.__history.addRoute(regExp, (function(path)
		{
			var args = this.__extractParameters(regExp, path);
			
			var params = conbo.isString(route) 
				? conbo.object((route.match(/:\w+/g) || []).map(function(r) { return r.substr(1); }), args) 
				: {}
				;
			
			callback && callback.apply(this, args);
			
			var options = 
			{
				router:		this,
				route:		regExp,
				name:		name,
				parameters:	args,
				params:		params,
				path:		path
			};
			
			this.dispatchEvent(new conbo.ConboEvent('route:'+name, options));
			this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.ROUTE, options));
			
		}).bind(this));
		
		return this;
	}
647327
public void addRouter(final Class<?> routeType, Object controller) {

        Method[] methods = routeType.getDeclaredMethods();
        if (BladeKit.isEmpty(methods)) {
            return;
        }

        String nameSpace = null, suffix = null;
        if (null != routeType.getAnnotation(Path.class)) {
            nameSpace = routeType.getAnnotation(Path.class).value();
            suffix = routeType.getAnnotation(Path.class).suffix();
        }

        if (null == nameSpace) {
            log.warn("Route [{}] not path annotation", routeType.getName());
            return;
        }

        for (Method method : methods) {

            com.blade.mvc.annotation.Route mapping     = method.getAnnotation(com.blade.mvc.annotation.Route.class);
            GetRoute                       getRoute    = method.getAnnotation(GetRoute.class);
            PostRoute                      postRoute   = method.getAnnotation(PostRoute.class);
            PutRoute                       putRoute    = method.getAnnotation(PutRoute.class);
            DeleteRoute                    deleteRoute = method.getAnnotation(DeleteRoute.class);

            this.parseRoute(RouteStruct.builder().mapping(mapping)
                    .getRoute(getRoute).postRoute(postRoute)
                    .putRoute(putRoute).deleteRoute(deleteRoute)
                    .nameSpace(nameSpace)
                    .suffix(suffix).routeType(routeType)
                    .controller(controller).method(method)
                    .build());
        }
    }