Register URL rule to application URL map.
327828
def _add_url_rule(url_or_urls):
    """"""
    old = current_app._got_first_request
    # This is bit of cheating to overcome @flask.app.setupmethod decorator.
    current_app._got_first_request = False
    if isinstance(url_or_urls, six.string_types):
        url_or_urls = [url_or_urls]
    map(lambda url: current_app.add_url_rule(url, 'invenio_pages.view', view),
        url_or_urls)
    current_app._got_first_request = old
48528
private Set<String> validateURL(ValidationHelper helper, Context context, String url) {
        String pathToCheck = url;
        Set<String> serverVariables = new HashSet<String>();

        while (pathToCheck.contains("{")) {
            if (!pathToCheck.contains("}")) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }
            int firstIndex = pathToCheck.indexOf("{");
            int lastIndex = pathToCheck.indexOf("}");

            if (firstIndex > lastIndex) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }

            String variable = pathToCheck.substring(firstIndex + 1, lastIndex);

            if (variable.isEmpty() || variable.contains("{") || variable.contains("/")) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }

            serverVariables.add(variable);
            pathToCheck = pathToCheck.substring(lastIndex + 1);
        }

        if (pathToCheck.contains("}")) {
            final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
            helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
            return serverVariables;
        }

        return serverVariables;
    }
623790
def set_urlroute_rules(rules=None):
    
    global __url_route_rules__
    __url_route_rules__ = []
    for k, v in (rules or {}).values():
        __url_route_rules__.append((re.compile(k), v))
1009827
void register(URL url, InMemoryMappingFile immf) {
        _data.put(url.getFile(), immf);
    }
718153
public void register( Map<String, String> namespaceUrisByPrefix ) {
        if (namespaceUrisByPrefix == null || namespaceUrisByPrefix.isEmpty()) return;
        final Lock lock = this.namespacesLock.writeLock();
        try {
            lock.lock();
            SystemContent systemContent = systemContent(false);
            systemContent.registerNamespaces(namespaceUrisByPrefix);
            systemContent.save();
            for (Map.Entry<String, String> entry : namespaceUrisByPrefix.entrySet()) {
                String prefix = entry.getKey().trim();
                String uri = entry.getValue().trim();
                if (prefix.length() == 0) continue;
                this.cache.register(prefix, uri);
            }
        } finally {
            lock.unlock();
        }
    }
1324912
def add_url_rule(self, rule, endpoint=None, view_func=None,
                     provide_automatic_options=None, register_with_babel=False,
                     **options):
        
        if self.unchained.babel_bundle and register_with_babel:
            self.unchained.babel_bundle.add_url_rule(
                self, rule, endpoint=endpoint, view_func=view_func,
                provide_automatic_options=provide_automatic_options, **options)
        return super().add_url_rule(rule, endpoint, view_func,
                                    provide_automatic_options, **options)
1305971
def register(self, method, uri, call_back):
        
        found = False

        self.create_route(uri, False)
        self.routes[uri]['handlers'].register_method(method,
                                                     call_back)
1207785
def _add_url_routes(self, app):
        """"""

        # Because methods contain an extra ``self`` parameter, URL routes are mapped
        # to stub functions, which simply call the corresponding method.

        # For testing purposes, we map all available URLs to stubs, but the stubs
        # contain config checks to return 404 when a feature is disabled.

        # Define the stubs
        # ----------------

        # def auth0_callback_stub():
        #     if not self.USER_ENABLE_AUTH0: abort(404)
        #     return self.auth0_callback_view()

        def change_password_stub():
            if not self.USER_ENABLE_CHANGE_PASSWORD: abort(404)
            return self.change_password_view()

        def change_username_stub():
            if not self.USER_ENABLE_CHANGE_USERNAME: abort(404)
            return self.change_username_view()

        def confirm_email_stub(token):
            if not self.USER_ENABLE_CONFIRM_EMAIL: abort(404)
            return self.confirm_email_view(token)

        def edit_user_profile_stub():
            return self.edit_user_profile_view()

        def email_action_stub(id, action):
            if not self.USER_ENABLE_MULTIPLE_EMAILS or not self.db_manager.UserEmailClass: abort(404)
            return self.email_action_view(id, action)

        def forgot_password_stub():
            if not self.USER_ENABLE_FORGOT_PASSWORD: abort(404)
            return self.forgot_password_view()

        def manage_emails_stub():
            if not self.USER_ENABLE_MULTIPLE_EMAILS or not self.db_manager.UserEmailClass: abort(404)
            return self.manage_emails_view()

        def invite_user_stub():
            if not self.USER_ENABLE_INVITE_USER: abort(404)
            return self.invite_user_view()

        def login_stub():
            return self.login_view()

        def logout_stub():
            return self.logout_view()

        def register_stub():
            if not self.USER_ENABLE_REGISTER: abort(404)
            return self.register_view()

        def resend_email_confirmation_stub():
            if not self.USER_ENABLE_CONFIRM_EMAIL: abort(404)
            return self.resend_email_confirmation_view()

        def reset_password_stub(token):
            if not self.USER_ENABLE_FORGOT_PASSWORD: abort(404)
            return self.reset_password_view(token)

        # def unconfirmed_email_stub():
        #     return self.unconfirmed_email_view()

        def unauthorized_stub():
            return self.unauthorized_view()


        # Add the URL routes
        # ------------------

        # app.add_url_rule('/callbacks/auth0', 'user.auth0_callback', auth0_callback_stub)
        app.add_url_rule(self.USER_CHANGE_PASSWORD_URL, 'user.change_password', change_password_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_CHANGE_USERNAME_URL, 'user.change_username', change_username_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_CONFIRM_EMAIL_URL, 'user.confirm_email', confirm_email_stub)
        app.add_url_rule(self.USER_EDIT_USER_PROFILE_URL, 'user.edit_user_profile', edit_user_profile_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_EMAIL_ACTION_URL, 'user.email_action', email_action_stub)
        app.add_url_rule(self.USER_FORGOT_PASSWORD_URL, 'user.forgot_password', forgot_password_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_INVITE_USER_URL, 'user.invite_user', invite_user_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_LOGIN_URL, 'user.login', login_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_LOGOUT_URL, 'user.logout', logout_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_MANAGE_EMAILS_URL, 'user.manage_emails', manage_emails_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_REGISTER_URL, 'user.register', register_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_RESEND_EMAIL_CONFIRMATION_URL, 'user.resend_email_confirmation',
                         resend_email_confirmation_stub,
                         methods=['GET', 'POST'])
        app.add_url_rule(self.USER_RESET_PASSWORD_URL, 'user.reset_password', reset_password_stub,
                         methods=['GET', 'POST'])
179074
public static void registerUrlProtocolHandler() {
        String handlers = System.getProperty(PROTOCOL_HANDLER, "");
        System.setProperty(PROTOCOL_HANDLER, ("".equals(handlers) ? HANDLERS_PACKAGE
                : handlers + "|" + HANDLERS_PACKAGE));
        resetCachedUrlHandlers();
    }
1315367
function(route, rule) {
            if (rule == null) rule = "base";
            if (_.isString(rule)) rule = Urls[rule];
            route = rule(route);
            window.location.href = route;
        }
1170331
def register(self, uri, prefix):
        '''
        '''
        if not is_valid_schema_uri(uri):
            raise KeyError(
                'cannot register invalid URI {} (prefix {})'.format(
                    uri, prefix))
        if not is_valid_prefix(prefix):
            raise ValueError(
                'cannot register invalid prefix %q for URI %q'.format(
                    prefix, uri))
        if self._uri_to_prefix.get(uri) is None:
            self._uri_to_prefix[uri] = prefix
893837
def rulefor(self, addr):
        """"""
        return self.rule.subgraph.node[self.rule.makeaddress(addr)][
            'target_obj']
405138
public void register(String pattern, HttpRequestHandler handler) {
        registry.register(pattern, handler);
        registry.register(pattern + "/", handler);
    }
693553
def _validateurl(self, url):
        """"""
        parsed = urlparse(url)
        path = parsed.path.strip("/")
        if path:
            parts = path.split("/")
            url_types = ("admin", "manager", "rest")
            if any(i in parts for i in url_types):
                while parts.pop() not in url_types:
                    next
            elif "services" in parts:
                while parts.pop() not in "services":
                    next
            path = "/".join(parts)
        else:
            path = "arcgis"
        self._adminUrl = "%s://%s/%s/admin" % (parsed.scheme, parsed.netloc, path)
        return "%s://%s/%s/rest/services" % (parsed.scheme, parsed.netloc, path)
579192
def registerStatsHandler(app, serverName, prefix='/status/'):
  """"""
  if prefix[-1] != '/':
    prefix += '/'
  handler = functools.partial(statsHandler, serverName)
  app.add_url_rule(prefix, 'statsHandler', handler, methods=['GET'])
  app.add_url_rule(prefix + '<path:path>', 'statsHandler', handler, methods=['GET'])
375249
def _init_routes(self):
        """"""
        self.url_map = Map()
        self.url_map.add(Rule('/static/_/<coll>/<path:filepath>', endpoint=self.serve_static))
        self.url_map.add(Rule('/static/<path:filepath>', endpoint=self.serve_static))
        self.url_map.add(Rule('/collinfo.json', endpoint=self.serve_listing))

        if self.is_valid_coll('$root'):
            coll_prefix = ''
        else:
            coll_prefix = '/<coll>'
            self.url_map.add(Rule('/', endpoint=self.serve_home))

        self.url_map.add(Rule(coll_prefix + self.cdx_api_endpoint, endpoint=self.serve_cdx))
        self.url_map.add(Rule(coll_prefix + '/', endpoint=self.serve_coll_page))
        self.url_map.add(Rule(coll_prefix + '/timemap/<timemap_output>/<path:url>', endpoint=self.serve_content))

        if self.recorder_path:
            self.url_map.add(Rule(coll_prefix + self.RECORD_ROUTE + '/<path:url>', endpoint=self.serve_record))

        if self.proxy_prefix is not None:
            # Add the proxy-fetch endpoint to enable PreservationWorker to make CORS fetches worry free in proxy mode
            self.url_map.add(Rule('/proxy-fetch/<path:url>', endpoint=self.proxy_fetch,
                                  methods=['GET', 'HEAD', 'OPTIONS']))
        self.url_map.add(Rule(coll_prefix + '/<path:url>', endpoint=self.serve_content))
802047
def buildURL(self, action, **query):
        """"""
        base = urllib.parse.urljoin(self.server.base_url, action)
        return appendArgs(base, query)