ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\HTTP\HTTPUtil Class Reference
+ Collaboration diagram for ILIAS\HTTP\HTTPUtil:

Public Member Functions

 __construct (HTTP\Services $http)
 
 sendString (string $output)
 
 deliverString (string $data, string $filename, string $mime="application/octet-stream")
 
 deliverStream (FileStream $stream, 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 31 of file class.HTTPUtil.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ deliverStream()

ILIAS\HTTP\HTTPUtil::deliverStream ( FileStream  $stream,
string  $filename,
string  $mime = "application/octet-stream" 
)

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

References ILIAS\FileDelivery\Delivery\DIRECT_PHP_OUTPUT, ILIAS\FileDelivery\Delivery\DISP_ATTACHMENT, and ILIAS\Repository\http().

72  : void {
73  $delivery = new Delivery(
75  $this->http
76  );
77  $delivery->setMimeType($mime);
78  $delivery->setSendMimeType(true);
79  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
80  $delivery->setDownloadFileName($filename);
81  $delivery->setConvertFileNameToAsci(true);
82  $repsonse = $this->http->response()->withBody($stream);
83  $this->http->saveResponse($repsonse);
84  $delivery->deliver();
85  }
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ deliverString()

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

Definition at line 49 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().

53  : void {
54  $delivery = new Delivery(
56  $this->http
57  );
58  $delivery->setMimeType($mime);
59  $delivery->setSendMimeType(true);
60  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
61  $delivery->setDownloadFileName($filename);
62  $delivery->setConvertFileNameToAsci(true);
63  $repsonse = $this->http->response()->withBody(Streams::ofString($data));
64  $this->http->saveResponse($repsonse);
65  $delivery->deliver();
66  }
$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\HTTP\HTTPUtil::sendString ( string  $output)

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

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

40  : void
41  {
42  $this->http->saveResponse($this->http->response()->withBody(
43  Streams::ofString($output)
44  ));
45  $this->http->sendResponse();
46  $this->http->close();
47  }
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\HTTP\HTTPUtil::$http
protected

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

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


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