public sendResource ( string $contentType = NULL ) : Nette\Application\IResponse | ||
$contentType | string | |
리턴 | Nette\Application\IResponse |
public function sendResource($contentType = NULL)
{
if (!$this->resource instanceof IResource) {
$this->resource = $this->resourceFactory->create($this->resource);
}
try {
$response = $this->responseFactory->create($this->resource, $contentType);
$this->sendResponse($response);
} catch (InvalidStateException $e) {
$this->sendErrorResource(BadRequestException::unsupportedMediaType($e->getMessage(), $e), $contentType);
}
}