pdf';
$response = new Zend_Controller_Response_Http();
// set the HTTP headers
$response->setHeader('Content-Type', 'application/pdf');
$response->setHeader('Content-Disposition',
'attachment; filename="'.$filename.'"');
$response->setHeader('Accept-Ranges', 'bytes');
$response->setHeader('Content-Length', filesize($filename));
// load the file to send into the body
$response->setBody(file_get_contents($filename));
echo $response;
The final container within the response object houses the exceptions. This is an array that can be added to
by calling $response->setException() and is used by Zend_Controller_Front to ensure that errors within your
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
code are not sent to the client, possibly exposing private information that may be used to compromise your
application. Of course, during development, you would want to see the errors, so the response has a setting,
renderExceptions, that you can set to true so that the exception text is displayed.
Front Controller Plug-ins
The front controller??™s architecture contains a plug-in system to allow user code to be executed automatically at
certain points in the routing and dispatching process.
Pages:
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65