Transmits the HTTP request from the client to the server

@throws HibiscusException
541069
public void execute() throws HibiscusException {

        prepare();

        httpRequest.addHeader("User-Agent", getClass().getName().toUpperCase());
        httpRequest.addHeader("X-Conversation-Id", HashGenerator.getMD5Hash(System.currentTimeMillis() + "." + new Thread().getId()));

        // Creates a registry for HTTP and HTTPS setting default ports to 80 and 443 respectively for these schemes
        // HTTP uses org.apache.http.conn.scheme.PlainSocketFactory
        // HTTPS uses org.apache.http.conn.ssl.SSLSocketFactory
        SchemeRegistry registry = SchemeRegistryFactory.createDefault();;

        PoolingClientConnectionManager connManager = new PoolingClientConnectionManager(registry);

        // This is necessary because of https://issues.apache.org/jira/browse/HTTPCLIENT-1193
        // We cannot use the Default constructor without overriding the connection manager from the default
        DefaultHttpClient requestClient = new DefaultHttpClient(connManager);

        try {

            final long startTime = System.currentTimeMillis();
            final HttpResponse response = requestClient.execute(httpRequest);
            final long elapsedTime = System.currentTimeMillis() - startTime;
            final HttpEntity responseEntity = response.getEntity();

            /* Capture the elapsed time for this request */
            this.responseTime = elapsedTime;

            /* This will reset the response object each time the request is made */
            this.response = new Response();

            /* Sets the status line and response headers */
            this.response.setStatusLine(response.getStatusLine().toString());
            this.response.setResponseHeaders(response.getAllHeaders());

            if (null != responseEntity) {
                this.response.setResponseBody(StreamUtil.inputStreamToString(responseEntity.getContent()));
            }

            if (log.isDebugEnabled()) {
                debugRequest(response);
            }

        } catch (IOException e) {
            throw new HibiscusException(e);
        }
    }
1114607
private static void streamRequest(Request request, ApiClient client, SocketListener listener) {
    WebSocketCall.create(client.getHttpClient(), request).enqueue(new Listener(listener));
  }
406255
public function send()
    {
        try {
            $this->requestParams = common_http_Request::currentRequest()->getParams();
            $this->launchData = LtiLaunchData::fromRequest(common_http_Request::currentRequest());
            $baseUrl = null;

            if ($this->requiresRedirect() && !empty($this->getReturnBaseUrl())) {
                $this->errorRedirectResponse();
            } else {
                echo $this->showLtiErrorPage();
            }
        } catch (\Exception $e) {
            $this->renderer->setTemplate(Template::getTemplate('error/error500.tpl', 'tao'));
            echo $this->renderer->render();
        }
    }
1291386
@Override
  public void deliver(WriteStream os, OutHttp2 out)
    throws IOException
  {
    _stream.writeCont(out);
  }
883496
@Override
    public void sendRequestHeaders() throws IOException, MessageSentException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "sendRequestHeaders(sync)");
        }
        if (headersSent()) {
            throw new MessageSentException("Headers already sent");
        }

        setPartialBody(true);
        getLink().setAllowReconnect(true);
        try {
            sendHeaders(getRequestImpl());
        } catch (IOException e) {
            // no FFDC required
            reConnect(e);
        }
        // check to see if we need to read the response now
        if (shouldReadResponseImmediately()) {
            startResponseReadSync();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "sendRequestHeaders(sync)");
        }
    }
804976
private void sendSomeRequests() {
		ResponseListener responseListener = new MyResponseListener();

		sendCustomUrlRequest(responseListener);
		sendAutoRetryRequest(responseListener);
		downloadImage(responseListener);
		uploadData(responseListener);
		uploadFile(responseListener);
		uploadText(responseListener);
	}
364668
public void sendRequest() throws IOException
    {
        /* Create & Format URL */
        URL url = new URL(CleverBotQuery.formatRequest(CleverBotQuery.URL_STRING, this.key, this.phrase, this.conversationID));

        /* Open Connection */
        URLConnection urlConnection = url.openConnection();

        /* Read input */
        BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
        String inputLine = in.readLine();

        /* Create JSON Object */
        JsonObject jsonObject = new JsonParser().parse(inputLine).getAsJsonObject(); // convert to JSON

        /* Get params */
        this.setConversationID(jsonObject.get("cs").getAsString()); // update conversation ID
        this.setResponse(jsonObject.get("output").getAsString()); // get output
        this.setRandomNumber(Integer.parseInt(jsonObject.get("random_number").getAsString())); // get output
        in.close(); // close!
    }
241210
public function sendHeaders()
    {
        // Throw exception if header already sent
        if ($this->headersSent()) {
            throw new ResponseException('Cannot send headers, headers already sent.');
        }

        /*
         | If headers not set already we will set header here
         */
        if (!$this->headers->has('Content-Type')) {
            $this->setHeader('Content-Type', $this->getContentType().'; charset='.$this->getCharset());
        }

        // Check if script is running in FCGI server
        if ($this->server('FCGI_SERVER_VERSION')) {
            //We will set Header for Fast-CGI server
            $this->setFastCgiHeader();
        } else {
            $this->setHeaderForServer();
        }

        foreach ($this->headers->all() as $name => $values) {
            foreach ($values as $value) {
                // Create the header and send it
                is_string($name) && $value = "{$name}: {$value}";
                header($value, true);
            }
        }

        return $this;
    }
994434
public function send()
    {
        if ( ! headers_sent()) {
            $this->sendHeaders();
        }
        http_response_code($this->status);
        echo $this->prepareContent($this->content);
    }
1248439
public function send()
    {
        $this->sendHeaders();
        $this->sendCookies();

        if (ResponseCode::canHaveBody($this->statusCode)) {
            $this->sendBody();
        }
    }
662002
protected function sendHeader()
	{
		$this->openHandle();

		$target= $this->path.($this->query? '?'.$this->query : '' ).($this->fragment? '#'.$this->fragment : '' );

		$this->writeLine("{$this->method} {$target} HTTP/{$this->version}");
		$this->writeLine("Host: {$this->host}");

		foreach( $this->headers as $key=>$value ){
			$this->writeLine("$key: $value");
		}
		$this->writeLine('');
	}
33584
public function send()
    {
        deprecationWarning('Response::send() will be removed in 4.0.0');

        if ($this->hasHeader('Location') && $this->_status === 200) {
            $this->statusCode(302);
        }

        $this->_setContent();
        $this->sendHeaders();

        if ($this->_file) {
            $this->_sendFile($this->_file, $this->_fileRange);
            $this->_file = null;
            $this->_fileRange = [];
        } else {
            $this->_sendContent($this->body());
        }

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        }
    }
346757
public function send ()
    {
        if ($this->_sent) {
            throw new CAS_OutOfSequenceException(
                'Request has already been sent cannot send again.'
            );
        }
        if (is_null($this->url) || !$this->url) {
            throw new CAS_OutOfSequenceException(
                'A url must be specified via setUrl() before the request can be sent.'
            );
        }
        $this->_sent = true;
        return $this->sendRequest();
    }
1035846
public function send() {
        header("HTTP/1.0 {$this->code} {$this->get_reason()}");
        foreach ($this->additionalheaders as $header) {
            header($header);
        }
        if (($this->code >= 200) && ($this->code < 300)) {
            if (!empty($this->contenttype)) {
                header("Content-Type: {$this->contenttype};charset=UTF-8");
            }
            if (!empty($this->body)) {
                echo $this->body;
            }
        }
    }
166445
public function send()
    {
        // prepare client
        $curl = new Curl(
            [
                'timeout' => 10,
            ]
        );
        $this->response = null;
        $this->response = $curl->sendRequest($this->getRequest());
    }
1373461
public function sendRequest()
    {
        if ($this->error->hasError() || !$this->http) {
            return;
        }

        if (class_exists($this->dispatcher)) {
            $dispatcherClass = $this->dispatcher;
            $dispatcher = new $dispatcherClass($this->instance->getQuery());
            if ($dispatcher instanceof AbstractDispatcher) {
                $payload = array(
                    'data' => json_encode(array(
                        'config' => $this->config->getRawConfig(),
                        'sql' => $this->instance->getQuery()->toString(),
                        'limit' => $this->instance->getQuery()->getLimit(),
                        'offset' => $this->instance->getQuery()->getOffset(),
                        'single' => $this->instance->getQuery()->isSingle(),
                    )),
                    'key' => $this->key,
                    'method' => $this->method,
                );
                $jsonResult = '[]';

                try {
                    // Guzzle Old
                    if (get_class($this->http) == 'Guzzle\Http\Client') {
                        $request = $this->http->post($this->url, array(), $payload);
                        $response = $request->send();
                        $jsonResult = $response->getBody(true);
                    }
                    // Guzzle 5+
                    elseif (get_class($this->http) == 'GuzzleHttp\Client') {
                        $response = $this->http->request('POST', $this->url, array('form_params' => $payload));
                        $jsonResult = $response->getBody();
                    }
                    // Builtin http client request
                    elseif ($this->http instanceof BuiltinRestClient) {
                        $jsonResult = self::post($this->url, $payload);
                    }

                    if ($this->method == 'getAvailableDrivers') {
                        $this->availableDrivers = json_decode((string) $jsonResult, true);
                    } elseif ($this->method == 'getServerVersion') {
                        $res = json_decode((string) $jsonResult, true);
                        $this->serverVersion = isset($res['version']) ? $res['version'] : null;
                    } else {
                        $dispatcher->dispatch((string) $jsonResult);
                    }
                } catch (\Exception $e) {
                    $this->error->setMessage(strip_tags($e->getMessage()));
                }
            } else {
                $this->error->setMessage(sprintf(
                    'Dispatcher class must be instance of %s, %s given',
                    AbstractDispatcher::class,
                    (string) $this->dispatcher
                ));
            }
        } else {
            $this->error->setMessage(sprintf('Class %s not found', (string) $this->dispatcher));
        }
    }
190012
public void sendData(Object req, Object res)
        throws Exception, IOException
    {
        this.sendData((HttpServletRequest)req, (HttpServletResponse)res);
    }