Esempio n. 1
0
 public function __construct(Request $request, HeadersSet $headersSet, Body $body)
 {
     $this->request = $request;
     $this->body = $body;
     $this->headersSet = $headersSet->merge($this->body->getHeadersSet());
     if ($this->headersSet->hasHeaders("Date") === false) {
         $this->headersSet->addHeader("Date", gmdate("D, d M Y H:i:s", time()) . " UTC");
     }
 }
Esempio n. 2
0
 public function __construct($exceptionString, $statusCode, $reasonPhrase = null)
 {
     $fullText = $this->getBeforeText();
     $fullText .= nl2br($exceptionString);
     $fullText .= $this->getAfterText();
     $this->text = $fullText;
     $this->statusCode = $statusCode;
     $this->reasonPhrase = $reasonPhrase;
     $this->headersSet = new HeadersSet();
     $this->headersSet->addHeader('Content-Type', 'text/html; charset=UTF-8; charset=utf-8');
     $this->headersSet->addHeader('Content-Length', strlen($this->text));
 }
Esempio n. 3
0
 public static function createImageTask(VariableMap $variableMap, ImagickTaskQueue $taskQueue, PageInfo $pageInfo, Request $request, HeadersSet $headersSet, $customImage, $params)
 {
     $job = $variableMap->getVariable('job', false);
     $text = "Image is still generating.";
     if ($job === false) {
         if ($taskQueue->isActive() == false) {
             //Queue isn't active - don't bother queueing a task
             return false;
         }
         $task = new \ImagickDemo\Queue\ImagickTask($pageInfo, $params, $customImage, $request->getUri()->getPath());
         $added = $taskQueue->addTask($task);
         if ($added === true) {
             $text = "Image added to task list";
         } else {
             $text = "Image task {$added} already present.";
         }
     }
     $caching = new \Room11\Caching\LastModified\Disabled();
     foreach ($caching->getHeaders(time()) as $key => $value) {
         $headersSet->addHeader($key, $value);
     }
     return new TextBody($text, 420);
 }
Esempio n. 4
0
 /**
  * @param Session $session
  * @param HeadersSet $headerSet
  * @return int
  */
 public static function addSessionHeader(Session $session, HeadersSet $headerSet)
 {
     $headers = $session->getHeaders(\ASM\SessionManager::CACHE_PRIVATE);
     foreach ($headers as $key => $value) {
         $headerSet->addHeader($key, $value);
     }
     $session->save();
     return TierApp::PROCESS_CONTINUE;
 }