Register a middleware with the coordinator.

    Args:
        middleware (EFBMiddleware): Middleware to register
15141
def add_middleware(middleware: EFBMiddleware):
    
    global middlewares
    if isinstance(middleware, EFBMiddleware):
        middlewares.append(middleware)
    else:
        raise TypeError("Middleware instance is expected")
931491
def register_backend(self, config_contents):
    
    if config_contents is None:
      return
    self.__register_class(config_contents)
    self.__api_configs.append(config_contents)
    self.__register_methods(config_contents)
1151191
@Override
	public void use(Collection<Middleware> middlewares) {
		LinkedList<Middleware> newMiddlewares = new LinkedList<>();
		final long stamp = lock.writeLock();
		try {

			// Register middlewares
			for (Middleware middleware : middlewares) {
				if (this.middlewares.add(middleware)) {
					newMiddlewares.add(middleware);
				}
			}

			// Apply new middlewares
			if (!newMiddlewares.isEmpty()) {
				for (Strategy<ActionEndpoint> strategy : strategies.values()) {
					List<ActionEndpoint> endpoints = strategy.getAllEndpoints();
					for (ActionEndpoint endpoint : endpoints) {
						for (Middleware middleware : newMiddlewares) {
							endpoint.use(middleware);
						}
					}
				}
			}

		} finally {
			lock.unlockWrite(stamp);
		}

		// Start new middlewares
		if (!newMiddlewares.isEmpty()) {
			for (Middleware middleware : newMiddlewares) {
				try {
					middleware.started(broker);
				} catch (MoleculerError moleculerError) {
					throw moleculerError;
				} catch (Exception cause) {
					throw new MoleculerError("Unable to start middleware!", cause, "MoleculerError", nodeID, false, 500,
							"MIDDLEWARE_ERROR");
				}
			}
		}
	}
1287236
def register(self, observer):
        
        self.observer_manager.append(observer)
        observer.manager = self
404588
def middleware(self, middleware_or_request):
        '''
        '''
        def register_middleware(middleware, attach_to='request'):
            if attach_to == 'request':
                self.request_middleware.append(middleware)
            if attach_to == 'response':
                self.response_middleware.appendleft(middleware)
            return middleware

        # Detect which way this was called, @middleware or @middleware('AT')
        if callable(middleware_or_request):
            return register_middleware(middleware_or_request)

        else:
            return partial(register_middleware,
                           attach_to=middleware_or_request)
978879
public function register()
  {
    $middleware = ($this->middleware !== null) ? ['middleware' => $this->middleware] : [];
    $prefix     = ($this->prefix !== null) ? ['prefix' => $this->prefix] : [];
    $domain     = ($this->domain !== null) ? ['domain' => $this->domain] : [];

    Swish::group(array_merge($domain, $middleware, $prefix), function() {
      startphp($this->file);
    });
  }
1223812
def register(coordinator):
    """"""

    if FLAGS.phantomjs_script:
        utils.verify_binary('phantomjs_binary', ['--version'])
        assert os.path.exists(FLAGS.phantomjs_script)
    else:
        utils.verify_binary('capture_binary', ['--version'])
        assert FLAGS.capture_script
        assert os.path.exists(FLAGS.capture_script)

    assert FLAGS.capture_threads > 0
    assert FLAGS.queue_server_prefix

    item = queue_worker.RemoteQueueWorkflow(
        constants.CAPTURE_QUEUE_NAME,
        DoCaptureQueueWorkflow,
        max_tasks=FLAGS.capture_threads,
        wait_seconds=FLAGS.capture_wait_seconds)
    item.root = True
    coordinator.input_queue.put(item)
239491
public function addMiddleware(MiddlewareInterface $middleware, $priority = 10)
    {
        $this->stack = $this->stack->withMiddleware($middleware, $priority);
        return $this;
    }
934027
def _init_middlewares(self):
        
        self.middleware = [DeserializeMiddleware()]
        self.middleware += \
            [FuncMiddleware(hook) for hook in self.before_hooks()]
        self.middleware.append(SerializeMiddleware())
1353741
def initialize(self, method, middleware, request_type):
        
        self.method = method
        self.middleware = middleware
        self.request_type = request_type
1181755
def register(self, app, options):
        """"""

        url_prefix = options.get('url_prefix', self.url_prefix)

        # Routes
        for future in self.routes:
            # attach the blueprint name to the handler so that it can be
            # prefixed properly in the router
            future.handler.__blueprintname__ = self.name
            # Prepend the blueprint URI prefix if available
            uri = url_prefix + future.uri if url_prefix else future.uri
            app.route(
                uri=uri[1:] if uri.startswith('//') else uri,
                methods=future.methods,
                host=future.host or self.host,
                strict_slashes=future.strict_slashes,
                stream=future.stream
                )(future.handler)

        # Middleware
        for future in self.middlewares:
            if future.args or future.kwargs:
                app.middleware(*future.args,
                               **future.kwargs)(future.middleware)
            else:
                app.middleware(future.middleware)

        # Exceptions
        for future in self.exceptions:
            app.exception(*future.args, **future.kwargs)(future.handler)

        # Static Files
        for future in self.statics:
            # Prepend the blueprint URI prefix if available
            uri = url_prefix + future.uri if url_prefix else future.uri
            app.static(uri, future.file_or_directory,
                       *future.args, **future.kwargs)

        # Event listeners
        for event, listeners in self.listeners.items():
            for listener in listeners:
                app.listener(event)(listener)
498917
def register(model, admin=None, category=None):
    
    def _model_admin_wrapper(admin_class):

        site.register(model, admin_class=admin_class)

        if category:
            site.register_block(model, category)

        return admin_class
    return _model_admin_wrapper
1305971
def register(self, method, uri, call_back):
        
        found = False

        self.create_route(uri, False)
        self.routes[uri]['handlers'].register_method(method,
                                                     call_back)
1158573
protected function registerHttpMiddleware()
    {
        // log
        $this->getHttp()->addMiddleware($this->logMiddleware());
        // retry
        $this->getHttp()->addMiddleware($this->retryMiddleware());
    }
679856
public function addMiddleware(MiddlewareInterface $middleware, int $priority = null): MiddlewareChain
    {
        $this->queue->insert($middleware, $priority ?: 1);

        return $this;
    }
512727
def add_middleware(self, middleware):
        """"""
        if self.middleware is None:
            self._middleware = []
        self.middleware.append(middleware)
1273457
private function registerLanguageMiddleware()
    {
        $this->info('Registering the Language middleware in Http/Kernel.php...');
        $this->helper->replaceAndSave($this->config->paths->project->Kernel, $this->oldKernelString, $this->newKernelString);
        $this->bar->advance();
    }