Changeset 1568

Show
Ignore:
Timestamp:
01/24/07 15:45:37 (2 years ago)
Author:
david
Message:

merging in changes from david-execution flow branch. contains remodeled execution flow system, totally new templating stuff, request data holders including painless header and file handling, new redirect system, and improved file validators. closes #373, #389, #184, #287, #377, #391

Location:
branches/0.11
Files:
8 removed
91 modified
17 copied

Legend:

Unmodified
Added
Removed
  • branches/0.11/RELEASE_NOTES

    r1332 r1568  
    3636Inside Actions and Views, it is not possible to access request parameters directly. Instead, a ParameterHolder passed to the execute() method will contain the request parameters. The idea behind this decision is that these parameters are safe for use if they have been filtered and normalized by validation or by some generic preprocessing filter (which, for instance, could remove any XSS related stuff). Also, with any strict validation mode enabled, only those variables that have been validated will be available for use. 
    3737 
    38 Inside a controller's dispatch() method, global filters now run first. This finally allows to implement features such as cookie based auto-logins etc, and also guarantees that these filters modify the actual final output of a request. The now-called "Action Filters" are identical to filters in 0.10 and earlier. Also, it is now possible to filter the rendering of templates via rendering filters. The result of these rendering filters are also included in any caching. 
     38Inside a controller's dispatch() method, global filters now run first. This finally allows to implement features such as cookie based auto-logins etc, and also guarantees that these filters modify the actual final output of a request. The now-called "Action Filters" are identical to filters in 0.10 and earlier.  
    3939 
    4040With the new concept of output types, Views may implement execute() methods specifically for an output type by containing an executeSomething() methods, with "something" being the name of the output type. 
     
    5959All configuration settings can either be valid under all situations, or only in one or more specific environments and/or contexts. This allows for very fine-grained control over what's happening. For instance, you can enable debug mode for the 'production' environment, or enable certain filters only in the 'web' context. 
    6060 
    61 'contexts.ini' is gone, and we re-introduced 'factories.xml'. New config files are 'output_types.xml', 'routing.xml' and 'translation.xml'. 'filters.xml' was split up into separate files for global-, rendering- and action filters. 
     61'contexts.ini' is gone, and we re-introduced 'factories.xml'. New config files are 'output_types.xml', 'routing.xml' and 'translation.xml'. 'filters.xml' was split up into separate files for global- and action filters. 
    6262 
    6363'autoload.xml' 'compile.xml' and 'config_handlers.xml' use the "global" Agavi configuration files as their parents so it's not necessary anymore to sync them after each upgrade of Agavi. 
  • branches/0.11/docs/docbook/introduction.xml

    r1336 r1568  
    207207      the Action (or skip execution if the Action doesn't serve the Request 
    208208      method), determine the View to execute and then execute the View and, 
    209       after that, start the rendering of the output by creating another filter 
    210       chain containing all the defined Rendering Filters and, as the last 
    211       element, the designated Renderer instance that will take care of 
    212       rendering the template. This functionality might be extended by other 
    213       Execution Filter implementations; for example, the 
    214       CachingExecutionFilter will try to load a cached version of the Action 
    215       and skip execution altogether if possible, resulting in a massive 
    216       performance increase.</para> 
     209      after that, start the rendering of the output.</para> 
    217210    </section> 
    218211  </chapter> 
  • branches/0.11/docs/docbook/manual.xml

    r1546 r1568  
    572572      the Action (or skip execution if the Action doesn't serve the Request 
    573573      method), determine the View to execute and then execute the View and, 
    574       after that, start the rendering of the output by creating another filter 
    575       chain containing all the defined Rendering Filters and, as the last 
    576       element, the designated Renderer instance that will take care of 
    577       rendering the template. This functionality might be extended by other 
    578       Execution Filter implementations; for example, the 
    579       CachingExecutionFilter will try to load a cached version of the Action 
    580       and skip execution altogether if possible, resulting in a massive 
    581       performance increase.</para> 
     574      after that, start the rendering of the output.</para> 
    582575    </section> 
    583576 
     
    14101403 
    14111404                <listitem> 
    1412                   <para>action_stack, controller, database_manager, 
    1413                   dispatch_filter, execution_filter, filter_chain, 
     1405                  <para>controller, database_manager, dispatch_filter 
     1406                  execution_container, execution_filter, filter_chain, 
    14141407                  logger_manager, request, response, routing, security_filter, 
    14151408                  storage, translation_manager, user, validator_manager</para> 
     
    16421635 
    16431636  &lt;handlers&gt; 
    1644    &lt;handler pattern="%core.module_dir%/*/config/rendering_filters.xml" validate="%core.agavi_dir%/config/xsd/filters.xsd" class="AgaviFilterConfigHandler" /&gt; 
     1637   &lt;handler pattern="%core.module_dir%/*/config/action_filters.xml" validate="%core.agavi_dir%/config/xsd/filters.xsd" class="AgaviFilterConfigHandler" /&gt; 
    16451638   &lt;handler pattern="%core.module_dir%/*/config/module.xml" validate="%core.agavi_dir%/config/xsd/module.xsd" class="AgaviModuleConfigHandler" /&gt; 
    16461639   &lt;handler pattern="%core.module_dir%/*/validate/*.xml" class="AgaviValidatorConfigHandler" /&gt; 
     
    18511844 
    18521845        <para>Available elements are <simplelist type="inline"> 
    1853             <member>"action_stack"</member> 
    1854  
    18551846            <member>"controller"</member> 
    18561847 
     
    18581849 
    18591850            <member>"dispatch_filter"</member> 
     1851 
     1852            <member>"execution_container"</member> 
    18601853 
    18611854            <member>"execution_filter"</member> 
     
    19091902      <title>FilterConfigHandler Tags (*_filters.xml)</title> 
    19101903 
    1911       <para>You may use <filename>action_filters.xml</filename>, 
    1912       <filename>global_filters.xml</filename> and 
    1913       <filename>rendering_filters.xml</filename> to configure Action, global 
    1914       or rendering filters. Action and rendering filters may also be specified 
    1915       on a per-module basis by putting them into the 
     1904      <para>You may use <filename>action_filters.xml</filename> and 
     1905      <filename>global_filters.xml</filename> to configure filters that wrap 
     1906      either the global execution flow or individual actions. Action filters 
     1907      may also be specified on a per-module basis by putting them into the 
    19161908      <filename>app/modules/ModuleName/config/</filename> folder.</para> 
    19171909 
  • branches/0.11/etc/olson/agavi/app/config/factories.xml

    r1223 r1568  
    99| The default configuration must at least define:                            | 
    1010|                                                                            | 
    11 |  action_stack          - The ActionStack class implementation.             | 
    1211|  controller            - The Controller class implementation.              | 
    1312|  dispatch_filter       - The DispatchFilter class implementation.          | 
     13|  execution_container   - The ExecutionContainer class implementation.      | 
    1414|  execution_filter      - The ExecutionFilter class implementation.         | 
    1515|  filter_chain          - The FilterChain class implementation.             | 
  • branches/0.11/samples/app/config/factories.xml

    r1487 r1568  
    99| The default configuration must at least define:                            | 
    1010|                                                                            | 
    11 |  action_stack          - The ActionStack class implementation.             | 
    1211|  controller            - The Controller class implementation.              | 
     12|  execution_container   - The ExecutionContainer class implementation.      | 
    1313|  execution_filter      - The ExecutionFilter class implementation.         | 
    1414|  request               - The Request class implementation.                 | 
     
    2626  <configuration> 
    2727     
    28     <action_stack class="AgaviActionStack" /> 
    29      
    30     <controller class="AgaviWebController" /> 
     28    <controller class="AgaviController" /> 
    3129     
    3230    <database_manager class="AgaviDatabaseManager" /> 
    3331     
    3432    <dispatch_filter class="AgaviDispatchFilter" /> 
     33     
     34    <execution_container class="AgaviExecutionContainer" /> 
    3535     
    3636    <execution_filter class="AgaviExecutionFilter" /> 
  • branches/0.11/samples/app/config/logging.xml

    r1433 r1568  
    1616  <configuration> 
    1717 
    18     <loggers default="default"> 
     18    <loggers default="any"> 
    1919 
    2020      <!-- logs only DEBUG messages --> 
    21       <logger name="debug" class="AgaviLogger" level="AgaviLogger::DEBUG"> 
     21      <logger name="any" class="AgaviLogger" level="AgaviLogger::ALL"> 
    2222        <appenders> 
    2323          <appender>DebugLogAppender</appender> 
     
    2525      </logger> 
    2626 
    27       <!-- logs only INFO messages --> 
    28       <logger name="default" class="AgaviLogger" level="AgaviLogger::INFO"> 
    29         <appenders> 
    30           <appender>ApplicationLogAppender</appender> 
    31         </appenders> 
    32       </logger> 
    33  
    34       <!-- logs everything but DEBUG and INFO messages --> 
    35       <logger name="error" class="AgaviLogger" level="AgaviLogger::ALL ^ AgaviLogger::DEBUG ^ AgaviLogger::INFO"> 
    36         <appenders> 
    37           <appender>ErrorLogAppender</appender> 
    38         </appenders> 
    39       </logger> 
    4027    </loggers> 
    4128    <appenders> 
     
    5138        </parameters> 
    5239      </appender> 
    53  
    54       <appender name="ApplicationLogAppender" class="AgaviFileLoggerAppender" layout="PassthruLayout"> 
    55         <parameters> 
    56           <parameter name="file">%core.app_dir%/log/application.log</parameter> 
    57         </parameters> 
    58       </appender> 
    59  
    60       <appender name="ErrorLogAppender" class="AgaviRotatingFileLoggerAppender" layout="PassthruLayout"> 
    61         <parameters> 
    62           <parameter name="file">%core.app_dir%/log/error.log</parameter> 
    63         </parameters> 
    64       </appender> 
    65  
    6640    </appenders> 
    6741 
    6842    <layouts> 
    69       <layout name="PassthruLayout" class="AgaviPassthruLoggerLayout" /> 
     43      <layout name="PassthruLayout" class="AgaviTimestampLoggerLayout" /> 
    7044    </layouts> 
    7145 
  • branches/0.11/samples/app/config/output_types.xml

    r1166 r1568  
    1212+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ 
    1313--> 
    14 <configurations> 
     14<configurations xmlns:xi="http://www.w3.org/2001/XInclude"> 
    1515   
    1616  <configuration context="web"> 
     
    1818       
    1919      <output_type name="html"> 
    20         <renderer class="AgaviPhpRenderer"> 
    21           <parameters> 
    22             <parameter name="assigns"> 
    23               <parameters> 
    24                 <parameter name="routing">r</parameter> 
    25                 <parameter name="request">req</parameter> 
    26                 <parameter name="controller">ctl</parameter> 
    27                 <parameter name="user">usr</parameter> 
    28                 <parameter name="translation_manager">tm</parameter> 
    29               </parameters> 
    30             </parameter> 
    31             <parameter name="i18n"> 
    32               <parameters> 
    33                 <parameter name="mode">subdir</parameter> 
    34               </parameters> 
    35             </parameter> 
    36           </parameters> 
    37         </renderer> 
     20        <renderers default="php"> 
     21          <renderer name="php" class="AgaviPhpRenderer"> 
     22            <parameters> 
     23              <parameter name="assigns"> 
     24                <parameters> 
     25                  <parameter name="routing">r</parameter> 
     26                  <parameter name="request">req</parameter> 
     27                  <parameter name="controller">ctl</parameter> 
     28                  <parameter name="user">usr</parameter> 
     29                  <parameter name="translation_manager">tm</parameter> 
     30                </parameters> 
     31              </parameter> 
     32            </parameters> 
     33          </renderer> 
     34        </renderers> 
     35        <layouts default="default">  
     36          <layout name="default">  
     37            <layers>  
     38              <layer name="content" class="AgaviFileTemplateLayer" /> 
     39              <layer name="decorator" class="AgaviFileTemplateLayer"> 
     40                <parameters>  
     41                  <parameter name="template">Master</parameter> 
     42                </parameters> 
     43              </layer> 
     44            </layers> 
     45          </layout> 
     46        </layouts> 
    3847        <parameters> 
    3948          <parameter name="Content-Type">text/html; charset=UTF-8</parameter> 
     
    4251       
    4352      <output_type name="xhtml"> 
    44         <renderer class="AgaviPhpRenderer"> 
    45           <parameters> 
    46             <parameter name="assigns"> 
    47               <parameters> 
    48                 <parameter name="routing">r</parameter> 
    49                 <parameter name="request">req</parameter> 
    50                 <parameter name="controller">ctl</parameter> 
    51                 <parameter name="user">usr</parameter> 
    52                 <parameter name="translation_manager">tm</parameter> 
    53               </parameters> 
    54             </parameter> 
    55           </parameters> 
    56         </renderer> 
     53        <xi:include href="#xpointer(//configurations/configuration[@context='web']/output_types/output_type[@name='html']/renderers)" /> 
     54        <xi:include href="#xpointer(//configurations/configuration[@context='web']/output_types/output_type[@name='html']/layouts)" /> 
    5755        <parameters> 
    5856          <parameter name="Content-Type">application/xhtml+xml; charset=UTF-8</parameter> 
  • branches/0.11/samples/app/config/routing.xml

    r1165 r1568  
    3535      <!-- If the HTTP Accept: header contains "application/xhtml+xml", set the output type to "xhtml". Look at output_types.xml for the declaration of that output type. Execution will not stop if this route matches. --> 
    3636      <route pattern="application/xhtml+xml" source="_SERVER[HTTP_ACCEPT]" output_type="xhtml" stop="false" /> 
    37        
     37     
    3838      <route name="disabled" pattern="^/disabled" module="Disabled" action="Index" /> 
    3939       
  • branches/0.11/samples/app/lib/filter/AgaviSampleAppCookieLoginFilter.class.php

    r908 r1568  
    2121   * 
    2222   * @param      AgaviFilterChain The filter chain. 
     23   * @param      AgaviExecutionContainer The current execution container. 
    2324   * 
    2425   * @throws     <b>AgaviFilterException</b> If an error occurs during execution. 
     
    2728   * @since      0.11.0 
    2829   */ 
    29   public function execute(AgaviFilterChain $filterChain, AgaviResponse $response) 
     30  public function execute(AgaviFilterChain $filterChain, AgaviExecutionContainer $container) 
    3031  { 
    31     $req = $this->getContext()->getRequest(); 
     32    $reqData = $this->getContext()->getRequest()->getRequestData(); 
    3233    $usr = $this->getContext()->getUser(); 
    3334     
    34     if(!$usr->isAuthenticated() && $req->hasCookie('autologon')) { 
    35       $login = $req->getCookie('autologon'); 
     35    if(!$usr->isAuthenticated() && $reqData->hasCookie('autologon')) { 
     36      $login = $reqData->getCookie('autologon'); 
    3637      try { 
    3738        $usr->login($login['username'], $login['password']); 
     
    4344    } 
    4445     
    45     $filterChain->execute($filterChain, $response); 
     46    $filterChain->execute($container); 
    4647  } 
    4748} 
  • branches/0.11/samples/app/lib/routing/AgaviSampleAppLanguageRoutingCallback.class.php

    r1154 r1568  
    55  protected $availableLocales = array(); 
    66   
    7   public function initialize(AgaviResponse $response, array &$route) 
     7  public function initialize(AgaviContext $context, array &$route) 
    88  {