示例#1
0
 /**
  * Output processing class instantiation (view or presentation factory)
  * Uses $this->_extension (from ParseURI) to choose a view class.
  */
 protected function _initView()
 {
     $this->_view = Oops_Server_View::getInstance($this->_extension);
     if (!is_object($this->_view)) {
         // suggested view is not available
         $this->_response->setCode(415);
     }
 }
示例#2
0
 function test_Headers()
 {
     $response = new Oops_Server_Response();
     $response->setHeader('key', 'value');
     $this->assertEquals('value', $response->getHeader('key'), 'getHeader(key) mismatch');
     $this->assertEquals(array('key' => 'value'), $response->getHeaders());
     $this->assertEquals("Key: value\n", $response->getHeadersAsString(false), 'headers as string do not match standards: ' . $response->getHeadersAsString(false));
     $response->setCode(403, true);
     $this->assertEquals("HTTP/1.x 403 Forbidden\nKey: value\n", $response->getHeadersAsString(), "response->getHeadersAsString with status line");
 }
示例#3
0
 /**
  *
  * @param Oops_Server_Response $response        	
  * @param int $code        	
  */
 protected function _changeCode($response, $code)
 {
     $response->setCode($code, true);
     $this->handle($response);
 }