ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Repository\HTTP\HTTPUtil Class Reference
+ Collaboration diagram for ILIAS\Repository\HTTP\HTTPUtil:

Public Member Functions

 __construct (HTTP\Services $http)
 
 sendString (string $output)
 
 deliverString (string $data, string $filename, string $mime="application/octet-stream")
 

Protected Attributes

HTTP Services $http
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 30 of file class.HTTPUtil.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Repository\HTTP\HTTPUtil::__construct ( HTTP\Services  $http)

Definition at line 34 of file class.HTTPUtil.php.

References ILIAS\Repository\HTTP\HTTPUtil\$http, and ILIAS\Repository\http().

35  {
36  $this->http = $http;
37  }
+ Here is the call graph for this function:

Member Function Documentation

◆ deliverString()

ILIAS\Repository\HTTP\HTTPUtil::deliverString ( string  $data,
string  $filename,
string  $mime = "application/octet-stream" 
)

Definition at line 48 of file class.HTTPUtil.php.

References ILIAS\FileDelivery\Delivery\DIRECT_PHP_OUTPUT, ILIAS\FileDelivery\Delivery\DISP_ATTACHMENT, ILIAS\Repository\http(), and ILIAS\Filesystem\Stream\Streams\ofString().

52  : void {
53  $delivery = new Delivery(
55  $this->http
56  );
57  $delivery->setMimeType($mime);
58  $delivery->setSendMimeType(true);
59  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
60  $delivery->setDownloadFileName($filename);
61  $delivery->setConvertFileNameToAsci(true);
62  $repsonse = $this->http->response()->withBody(Streams::ofString($data));
63  $this->http->saveResponse($repsonse);
64  $delivery->deliver();
65  }
$filename
Definition: buildRTE.php:78
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
+ Here is the call graph for this function:

◆ sendString()

ILIAS\Repository\HTTP\HTTPUtil::sendString ( string  $output)

Definition at line 39 of file class.HTTPUtil.php.

References ILIAS\Repository\http(), and ILIAS\Filesystem\Stream\Streams\ofString().

39  : void
40  {
41  $this->http->saveResponse($this->http->response()->withBody(
42  Streams::ofString($output)
43  ));
44  $this->http->sendResponse();
45  $this->http->close();
46  }
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $http

HTTP Services ILIAS\Repository\HTTP\HTTPUtil::$http
protected

Definition at line 32 of file class.HTTPUtil.php.

Referenced by ILIAS\Repository\HTTP\HTTPUtil\__construct().


The documentation for this class was generated from the following file: