Register the resource on the resource name or a custom url
165292
def register_resource(mod, view, **kwargs):
    """"""
    resource_name = view.__name__.lower()[:-8]
    endpoint = kwargs.get('endpoint', "{}_api".format(resource_name))
    plural_resource_name = inflect.engine().plural(resource_name)
    path = kwargs.get('url', plural_resource_name).strip('/')
    url = '/{}'.format(path)
    setattr(view, '_url', url)  # need this for 201 location header
    view_func = view.as_view(endpoint)

    mod.add_url_rule(url, view_func=view_func,
                     methods=['GET', 'POST', 'OPTIONS'])
    mod.add_url_rule('{}/<obj_id>'.format(url),
                     view_func=view_func,
                     methods=['GET', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'])
417669
def register_route(self, app):
        """"""
        if "url" not in self.params["options"]:
            raise Exception("Component does not have a URL property")

        if not hasattr(self.route_func, "__call__"):
            raise Exception("No app route function supplied")

        app.add_url_rule(self.params["options"]["url"],
            self.params["options"]["url"],
            self.route_func)
1161805
def resource_url(self):
        """"""
        self._resource_url = self._resource_url or st.get_rest_api()
        return self._resource_url
780014
def register(resource_class, options = {}, &block)
      config = find_or_build_resource(resource_class, options)

      # Register the resource
      register_resource_controller(config)
      parse_registration_block(config, &block) if block_given?
      reset_menu!

      # Dispatch a registration event
      ActiveSupport::Notifications.publish ActiveAdmin::Resource::RegisterEvent, config

      # Return the config
      config
    end
1089759
def resources(name)
      get "#{name}", to: "#{name}#index"
      get "#{name}/new", to: "#{name}#new" unless api_mode?
      get "#{name}/:id", to: "#{name}#show"
      post "#{name}", to: "#{name}#create"
      get "#{name}/:id/edit", to: "#{name}#edit" unless api_mode?
      put "#{name}/:id", to: "#{name}#update"
      post "#{name}/:id", to: "#{name}#update" # for binary uploads
      patch "#{name}/:id", to: "#{name}#update"
      delete "#{name}/:id", to: "#{name}#delete"
    end
1364286
private String attachRequestString(String resourceName) {

        StringBuffer result = new StringBuffer(resourceName);
        boolean firstParam = true;
        if (resourceName.indexOf('?') == -1) {
            // no params in uri yet?
            result.append('?');
        } else {
            firstParam = false;
        }

        @SuppressWarnings("unchecked")
        Map<String, String[]> params = getJsp().getRequest().getParameterMap();
        Iterator<Map.Entry<String, String[]>> it = params.entrySet().iterator();
        String[] values = null;
        while (it.hasNext()) {
            if (values == null) {
                // first iteration: check if params before so an & has to be used.
                if (!firstParam) {
                    result.append('&');
                }
            } else {
                result.append("&");
            }
            Map.Entry<String, String[]> entry = it.next();
            result.append(entry.getKey().toString()).append('=');
            values = entry.getValue();
            for (int i = 0; i < values.length; i++) {
                result.append(values[i]);
                if ((i + 1) < values.length) {
                    result.append(',');
                }
            }
        }
        return result.toString();
    }
590306
def register_resources(klass, registry, resource_class):
        
        config_type = getattr(resource_class.resource_type, 'config_type', None)
        if config_type is None:
            return
        resource_class.filter_registry.register('json-diff', klass)
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();
        }
    }
411961
def res_to_url(resource, action):
    """"""
    i = action.find("_")
    if i < 0:
        url = "/" + resource
        httpmethod = action
    else:
        url = "/%s/%s" % (resource, action[i + 1:])
        httpmethod = action[:i]
    return url, httpmethod.upper()
1033194
public function registerResource(Resources\Resource $resource)
  {
      $this->resources[strtolower($resource->getName())] = $resource;
  }
548643
def resource(*args, &block)
      resource = @resource.resource(*args, &block)
      resource && ResourceAndAddress.new(resource, @address)
    end
1201561
def _register_resources(self, api_dirs, do_checks):
        ''''''
        msg = 'Looking-up for APIs in the following directories: {}'
        log.debug(msg.format(api_dirs))
        if do_checks:
            check_and_load(api_dirs)
        else:
            msg = 'Loading module "{}" from directory "{}"'
            for loader, mname, _ in pkgutil.walk_packages(api_dirs):
                sys.path.append(os.path.abspath(loader.path))
                log.debug(msg.format(mname, loader.path))
                import_module(mname)
380398
def add_resources_to_registry():
    
    from deform.widget import default_resource_registry

    default_resource_registry.set_js_resources("jqueryui", None, None)
    default_resource_registry.set_js_resources("datetimepicker", None, None)
    default_resource_registry.set_js_resources("custom_dates", None, None)
    default_resource_registry.set_js_resources(
        "radio_choice_toggle", None, None
    )
    default_resource_registry.set_js_resources("checkbox_toggle", None, None)

    from js.deform import resource_mapping
    # fix missing resource
    from js.select2 import select2
    resource_mapping['select2'] = select2
    # add the datetimepicker
    from js.jquery_timepicker_addon import timepicker
    resource_mapping['datetimepicker'] = timepicker

    resource_mapping['custom_dates'] = custom_dates
    resource_mapping['radio_choice_toggle'] = radio_choice_toggle
    resource_mapping['checkbox_toggle'] = checkbox_toggle
37050
public static void register(Context context, int id) {
        register(context, context.getResources().getResourceName(id));
    }
1008887
public final void addResource(final String resouceName,
			final URL urlToResource) {
		if ((urlToResource == null) || (resouceName == null)) {
			return;
		}
		if (this.resourcesMap.containsKey(resouceName.replace('\\', '/'))) {
			final Object to = this.resourcesMap.get(resouceName.replace('\\',
					'/'));
			if (to instanceof URL) {
				final URL uo = (URL) to;
				final List l = new ArrayList();
				l.add(uo);
				this.resourcesMap.put(resouceName.replace('\\', '/'), l);
			} else if (to instanceof List) {
				final List uo = (List) to;
				uo.add(urlToResource);
				this.resourcesMap.put(resouceName.replace('\\', '/'), uo);
			}
		} else {
			this.resourcesMap
					.put(resouceName.replace('\\', '/'), urlToResource);
		}
	}
1181666
def custom_resource(self, name, restype, factclass, props):
	
		
		
		return CustomResource(self.__endpoint, name, restype, factclass, props)
269061
def add_resource_route( method, url, controller_action )
      #resource = get_resource_name( url )
      resource = controller_action.split('#').first
      info =  {
        resource: resource,
        action: controller_action.split('#').last,
        method: method,
        url: url ,
        controller: controller_action.split('#').first
      }

      @resources_routes[resource.to_sym] ||= []
      @resources_routes[resource.to_sym].push( info )
    end