/*

Calls the request method on the controller to request a subtree for each node.
349328
function(nodes, controller) {
        var counter = 0, len = nodes.length, nodeSelected = {};
        var complete = function() { controller.onComplete(); };
        var viz = this.viz;
        if(len == 0) complete();
        for(var i=0; i<len; i++) {
            nodeSelected[nodes[i].id] = nodes[i];
            controller.request(nodes[i].id, nodes[i]._level, {
                onComplete: function(nodeId, data) {
                    if(data && data.children) {
                        data.id = nodeId;
                        viz.op.sum(data, { type: 'nothing' });
                    }
                    if(++counter == len) {
                        viz.graph.computeLevels(viz.root, 0);
                        complete();
                    }
                }
            });
        }
    }
782712
def prepare_request(node):
    
    if node.resource.method not in AVAILABLE_METHODS:
        raise UnsupportedHTTPMethodError(node.resource.method)

    def request(data=None, json=None, **kwargs):
        """
            Make request to node's API route with the given keyword arguments
        """
        # validate given query parameters
        for key, value in kwargs.items():
            param = next((p for p in node.resource.query_params if p.name == key), None)
            if not param:
                raise UnsupportedQueryParameter(node.resource.path, key)

            if not match_type(value, param.type):
                raise TypeError(
                    "Resource Query Parameter has type '{0}' but expected type '{1}'".format(
                        value.__class__.__name__, param.type))

        response = requests.request(node.resource.method, node.resource.absolute_uri, params=kwargs,
                                    data=data, json=json)
        return response
    return request
227903
public void requestNodeInfo(int nodeId) {
		SerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.RequestNodeInfo, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.ApplicationUpdate, SerialMessage.SerialMessagePriority.High);
    	byte[] newPayload = { (byte) nodeId };
    	newMessage.setMessagePayload(newPayload);
    	this.enqueue(newMessage);
	}
926840
public KdTree.Node requestNode() {
		if( unusedNodes.isEmpty() )
			return new KdTree.Node();
		return unusedNodes.remove( unusedNodes.size()-1);
	}
1171085
private void fillDataStructures() {
        final ITreeData treeData = mRtx.getNode();
        mInOrder.put(treeData, true);
        mDescendants.put(treeData, 1L);
    }
1299347
protected function initiateSubRequest()
    {
        if (!$this->controller instanceof AbstractWidgetController) {
            if (isset($this->controller)) {
                throw new MissingControllerException('initiateSubRequest() can not be called if there is no valid controller extending TYPO3\\CMS\\Fluid\\Core\\Widget\\AbstractWidgetController. Got "' . get_class($this->controller) . '" in class "' . get_class($this) . '".', 1289422564);
            }
            throw new MissingControllerException('initiateSubRequest() can not be called if there is no controller inside $this->controller. Make sure to add a corresponding injectController method to your WidgetViewHelper class "' . get_class($this) . '".', 1284401632);
        }
            /** @var $subRequest \ApacheSolrForTypo3\Solr\Widget\WidgetRequest */
        $subRequest = $this->objectManager->get(SolrFluidWidgetRequest::class);
        $subRequest->setWidgetContext($this->widgetContext);

        $this->passArgumentsToSubRequest($subRequest);
        $subResponse = $this->objectManager->get(Response::class);
        $this->controller->processRequest($subRequest, $subResponse);
        return $subResponse;
    }
320592
public void requestLayout() {
        mLayoutRequested = true;

        Log.v(Log.SUBSYSTEM.LAYOUT, TAG,
                "requestLayout(%s): mParent: '%s', mParent.isLayoutRequested: %b",
                getName(), mParent == null ? "<NULL>" : mParent.getName(),
                mParent != null && mParent.isLayoutRequested());

        if (mParent != null && !mParent.isLayoutRequested()) {
            Log.v(Log.SUBSYSTEM.LAYOUT, TAG, "requestLayout(%s) requesting", getName());
            mParent.requestLayout();
            // new RuntimeException().printStackTrace();
        } else if (isInLayout()) {
            requestInnerLayout(this);
        }
    }
122196
protected function initiateSubRequest()
    {
        $objectManager = new ObjectManager();
        $this->controller = $objectManager->get(PaginateController::class);

        return parent::initiateSubRequest();
    }
820277
@Override
	public void serviceRequest(final Request request) {
		// Only apply for POST
		if ("POST".equals(request.getMethod())) {
			// Apply Controls (Use values on request)
			SubordinateControlHelper.applyRegisteredControls(request, true);
		}

		// Service Request
		super.serviceRequest(request);
	}
1166732
public function build(): RequestChildNodesRequest
	{
		$instance = new RequestChildNodesRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		$instance->depth = $this->depth;
		$instance->pierce = $this->pierce;
		return $instance;
	}
96302
public static function activeTree(NavigationTree $tree, Request $request) {
        self::activeNodes($request, $tree->getNodes());
    }
572158
private function dumpStructure() {
    dump("Requesters:");
    dump($this->requesters);

    dump("Request roots:");
    dump($this->requestRoots);

    dump("Request paths:");
    dump($this->requestPaths);

    dump("Local names:");
    dump($this->localNames);

    if (isset($this->tree)) {
      dump("Containment tree:");
      dump($this->tree);
    }
  }
175971
public void invoke(HttpServletRequest req, HttpServletResponse rsp, Object root, String url) throws IOException, ServletException {
        RequestImpl sreq = new RequestImpl(this, req, new ArrayList<AncestorImpl>(), new TokenList(url));
        RequestImpl oreq = CURRENT_REQUEST.get();
        CURRENT_REQUEST.set(sreq);

        ResponseImpl srsp = new ResponseImpl(this, rsp);
        ResponseImpl orsp = CURRENT_RESPONSE.get();
        CURRENT_RESPONSE.set(srsp);

        try {
            invoke(sreq,srsp,root);
        } finally {
            CURRENT_REQUEST.set(oreq);
            CURRENT_RESPONSE.set(orsp);
        }
    }
218740
protected function loadStructure()
    {
        // Method ajaxTreeView is in TreeView.php - watch out!
        $response = new Response(
            $this->getDataContainer()->ajaxTreeView($this->getAjaxId(), (int) $this->getPost('level'))
        );

        throw new ResponseException($response);
    }
980215
function requestNextHashTree(ws) {
	db.query("SELECT COUNT(1) AS count_left FROM catchup_chain_balls", function (rows) {
		if (rows.length > 0) {
			if (catchup_balls_at_start == -1) { // first time to get all catchup ball number
				catchup_balls_at_start = rows[0].count_left;
			}
			catchup_balls_left = rows[0].count_left;
		}
	});
	db.query("SELECT ball FROM catchup_chain_balls ORDER BY member_index LIMIT 2", function (rows) {
		if (rows.length === 0)
			return comeOnline();
		if (rows.length === 1) {
			db.query("DELETE FROM catchup_chain_balls WHERE ball=?", [rows[0].ball], function () {
				comeOnline();
			});
			return;
		}

		let from_ball = rows[0].ball;
		let to_ball = rows[1].ball;

		// don't send duplicate requests
		for (let tag in ws.assocPendingRequests) {
			if (ws.assocPendingRequests[tag].request.command === 'get_hash_tree') {
				console.log("already requested hash tree from this peer");
				return;
			}
		}

		//	...
		sendRequest(ws, 'get_hash_tree', {from_ball: from_ball, to_ball: to_ball}, true, handleHashTree);
	});
}
1159305
private ObjectJS jsonTreeNode(CallTreeNode node, StringifierFactory jsonStringifierFactory) {
		final ObjectJS nodeJS = ObjectJS.create(node, jsonStringifierFactory);
		if (!node.getChildren().isEmpty()) {
			final ArrayJS childNodesJS=new ArrayJS(node.getChildren().size());
			for(CallTreeNode childNode:node.getChildren()) {
				childNodesJS.addElement(jsonTreeNode(childNode, jsonStringifierFactory));
			}
			nodeJS.setAttribute("children", childNodesJS);
		}
		return nodeJS;
	}
1336020
function (root) {
      if (root.refresh) {
        root.refresh()
        return
      }
      for (var i = 0; i < root.children.length; i++) {
        refreshTree(root.children[i])
      }
    }