Changeset 2205
- Timestamp:
- 12/06/07 02:46:59 (13 months ago)
- Location:
- branches/0.11/src
- Files:
-
- 7 modified
-
controller/AgaviController.class.php (modified) (1 diff)
-
controller/AgaviExecutionContainer.class.php (modified) (5 diffs)
-
filter/AgaviExecutionFilter.class.php (modified) (4 diffs)
-
filter/AgaviExecutionTimeFilter.class.php (modified) (1 diff)
-
filter/AgaviFormPopulationFilter.class.php (modified) (1 diff)
-
response/AgaviResponse.class.php (modified) (4 diffs)
-
response/AgaviWebResponse.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/src/controller/AgaviController.class.php
r2108 r2205 195 195 196 196 if($this->getParameter('send_response')) { 197 $response->send( $container->getOutputType());197 $response->send(); 198 198 } 199 199 -
branches/0.11/src/controller/AgaviExecutionContainer.class.php
r2115 r2205 120 120 $this->outputTypeName = $this->outputType->getName(); 121 121 $arr = get_object_vars($this); 122 unset($arr['context'], $arr['outputType'], $arr['requestData'] );122 unset($arr['context'], $arr['outputType'], $arr['requestData'], $arr['globalRequestData']); 123 123 return array_keys($arr); 124 124 } … … 137 137 $this->context = AgaviContext::getInstance($this->contextName); 138 138 $this->outputType = $this->context->getController()->getOutputType($this->outputTypeName); 139 $rq = $this->context->getRequest(); 140 if($rq->isLocked()) { 141 $this->requestData = new AgaviRequestDataHolder(); 142 } else { 143 $this->requestData = $rq->getRequestData(); 139 try { 140 $this->globalRequestData = $this->context->getRequest()->getRequestData(); 141 } catch(AgaviException $e) { 142 $this->globalRequestData = new AgaviRequestDataHolder(); 144 143 } 145 144 unset($this->contextName, $this->outputTypeName); … … 162 161 163 162 $this->parameters = $parameters; 163 164 $rfi = $this->context->getFactoryInfo('response'); 165 $this->response = new $rfi['class']; 166 $this->response->initialize($this->context, $rfi['parameters']); 164 167 } 165 168 … … 481 484 { 482 485 $this->response = $response; 486 // do not set the output type on the response here! 483 487 } 484 488 … … 507 511 { 508 512 $this->outputType = $outputType; 513 if($this->response) { 514 $this->response->setOutputType($outputType); 515 } 509 516 } 510 517 -
branches/0.11/src/filter/AgaviExecutionFilter.class.php
r2200 r2205 302 302 } 303 303 304 // create a new response instance for this action 305 $rfi = $this->context->getFactoryInfo('response'); 306 $response = new $rfi['class']; 307 $response->initialize($this->context, $rfi['parameters']); 308 $container->setResponse($response); 304 // clear the response 305 $response = $container->getResponse(); 306 $response->clear(); 309 307 310 308 // clear any forward set, it's ze view's job … … 435 433 $attributes =& $viewInstance->getAttributes(); 436 434 437 // lock the request. doing it here for all runs is fine, and quicker too438 $key = $request->toggleLock();439 435 // $lm->log('Starting rendering...'); 440 436 for($i = 0; $i < count($layers); $i++) { … … 469 465 'view' => $viewInstance, 470 466 ); 467 // lock the request. can't be done outside the loop for the whole run, see #628 468 $key = $request->toggleLock(); 471 469 $nextOutput = $layer->getRenderer()->render($layer, $attributes, $output, $moreAssigns); 470 // and unlock the request again 471 $request->toggleLock($key); 472 472 473 473 $response->setContent($nextOutput); … … 480 480 $output[$layer->getName()] = $nextOutput; 481 481 } 482 // and unlock the request again483 $request->toggleLock($key);484 482 } 485 483 -
branches/0.11/src/filter/AgaviExecutionTimeFilter.class.php
r1680 r2205 64 64 $filterChain->execute($container); 65 65 66 $outputTypes = (array) $this->getParameter('output_types');67 if(is_array($outputTypes) && !in_array($container->getOutputType()->getName(), $outputTypes)) {68 return;69 }70 71 66 $response = $container->getResponse(); 72 67 73 if(!$response->isContentMutable()) { 68 $outputTypes = (array) $this->getParameter('output_types'); 69 if(!$response->isContentMutable() || (is_array($outputTypes) && !in_array($response->getOutputType()->getName(), $outputTypes))) { 74 70 return; 75 71 } -
branches/0.11/src/filter/AgaviFormPopulationFilter.class.php
r2168 r2205 78 78 $cfg = $rq->getAttributes('org.agavi.filter.FormPopulationFilter'); 79 79 80 $ot = $ container->getOutputType();80 $ot = $response->getOutputType(); 81 81 82 82 if(is_array($cfg['output_types']) && !in_array($ot->getName(), $cfg['output_types'])) { -
branches/0.11/src/response/AgaviResponse.class.php
r1960 r2205 41 41 42 42 /** 43 * @var AgaviOutputType The output type of this response. 44 */ 45 protected $outputType = null; 46 47 /** 43 48 * Pre-serialization callback. 44 49 * … … 50 55 public function __sleep() 51 56 { 57 $vars = get_object_vars($this); 58 $also = array(); 59 52 60 $this->contextName = $this->context->getName(); 61 unset($vars['context']); 62 $also[] = 'contextName'; 63 64 if($this->outputType) { 65 $this->outputTypeName = $this->outputType->getName(); 66 unset($vars['outputType']); 67 $also[] = 'outputTypeName'; 68 } 69 53 70 if(is_resource($this->content)) { 54 71 $this->contentStreamMeta = stream_get_meta_data($this->content); 55 } 56 $arr = get_object_vars($this); 57 unset($arr['context']); 58 if(isset($this->contentStreamMeta)) { 59 unset($arr['content']); 60 } 61 return array_keys($arr); 72 unset($vars['content']); 73 $also[] = 'contentStreamMeta'; 74 } 75 76 return array_merge(array_keys($vars), $also); 62 77 } 63 78 … … 74 89 $this->context = AgaviContext::getInstance($this->contextName); 75 90 unset($this->contextName); 91 92 if(isset($this->outputTypeName)) { 93 $this->outputType = $this->context->getController()->getOutputType($this->outputTypeName); 94 unset($this->outputTypeName); 95 } 96 76 97 if(isset($this->contentStreamMeta)) { 77 98 // contrary to what the documentation says, stream_get_meta_data() will not return a list of filters attached to the stream, so we cannot restore these, unfortunately. … … 107 128 $this->context = $context; 108 129 $this->setParameters($parameters); 130 } 131 132 /** 133 * Get the Output Type to use with this response. 134 * 135 * @return AgaviOutputType The Output Type instance associated with. 136 * 137 * @author David Zülke <dz@bitxtender.com> 138 * @since 0.11.1 139 */ 140 public function getOutputType() 141 { 142 return $this->outputType; 143 } 144 145 /** 146 * Set the Output Type to use with this response. 147 * 148 * @param AgaviOutputType The Output Type instance to associate with. 149 * 150 * @author David Zülke <dz@bitxtender.com> 151 * @since 0.11.1 152 */ 153 public function setOutputType(AgaviOutputType $outputType) 154 { 155 $this->outputType = $outputType; 156 } 157 158 /** 159 * Clear the Output Type to use with this response. 160 * 161 * @author David Zülke <dz@bitxtender.com> 162 * @since 0.11.1 163 */ 164 public function clearOutputType() 165 { 166 $this->outputType = null; 109 167 } 110 168 -
branches/0.11/src/response/AgaviWebResponse.class.php
r2171 r2205 592 592 protected function sendHttpResponseHeaders(AgaviOutputType $outputType = null) 593 593 { 594 if($outputType === null) { 595 $outputType = $this->getOutputType(); 596 } 597 594 598 $file = $line = ''; 595 599 if(headers_sent($file, $line)) {

