eZ\Publish\Core\REST\Common\Output\Visitor::getResponse PHP Method

getResponse() public method

public getResponse ( ) : Response
return Symfony\Component\HttpFoundation\Response
    public function getResponse()
    {
        return $this->response;
    }

Usage Example

 /**
  * @param Visitor   $visitor
  * @param Generator $generator
  * @param \eZ\Publish\Core\REST\Server\Values\CachedValue $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $visitor->visitValueObject($data->value);
     if ($this->getParameter('content.view_cache') !== true) {
         return;
     }
     $response = $visitor->getResponse();
     $response->setPublic();
     $response->setVary('Accept');
     if ($this->getParameter('content.ttl_cache') === true) {
         $response->setSharedMaxAge($this->getParameter('content.default_ttl'));
         if (isset($this->request) && $this->request->headers->has('X-User-Hash')) {
             $response->setVary('X-User-Hash', false);
         }
     }
     if (isset($data->cacheTags['locationId'])) {
         $visitor->getResponse()->headers->set('X-Location-Id', $data->cacheTags['locationId']);
     }
 }
All Usage Examples Of eZ\Publish\Core\REST\Common\Output\Visitor::getResponse