xml-axkit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject cvs commit: xml-axkit/lib AxKit.pm
Date Thu, 20 May 2004 18:33:45 GMT
mach        2004/05/20 11:33:45

  Modified:    lib      Tag: axkit-pipeline-2 AxKit.pm
  Log:
  Moving get styles,
  calling pipeline controller class
  reimplementing somestuff that shouldn't have moved
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.53.2.5  +39 -85    xml-axkit/lib/AxKit.pm
  
  Index: AxKit.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/AxKit.pm,v
  retrieving revision 1.53.2.4
  retrieving revision 1.53.2.5
  diff -u -r1.53.2.4 -r1.53.2.5
  --- AxKit.pm	10 Dec 2003 22:43:08 -0000	1.53.2.4
  +++ AxKit.pm	20 May 2004 18:33:45 -0000	1.53.2.5
  @@ -14,7 +14,6 @@
   use Apache::AxKit::Provider::File;
   use Apache::AxKit::Provider::Scalar;
   use Apache::AxKit::CharsetConv;
  -use Apache::AxKit::PipeCtrl;
   use File::Basename ();
   use Compress::Zlib ();
   use Fcntl;
  @@ -178,11 +177,17 @@
        local $SIG{'USR2'} = sub { 
            Carp::confess("caught SIGUSR2!");
        };
  +
  +    local($AxKit::Cfg) = Apache::AxKit::ConfigReader->new($r);
  +    
  +    my $controller = $AxKit::Cfg->PipelineControllerClass();
  +    
  +    load_module( $controller );
       
  -	local($AxKit::Pipeline) = Apache::AxKit::PipeCtrl->new();    
  +	local($AxKit::Pipeline) = $controller->new($r);
  +
       my $rc = $r->status();
       
  -    $AxKit::Cfg = Apache::AxKit::ConfigReader->new($r);
   
   #    if ($AxKit::Cfg->DebugTime) {
   #        require Time::HiRes;
  @@ -233,13 +238,20 @@
       local $AxKit::Cfg;
       local $AxKit::DebugLevel;
       local $Error::Debug;
  -	local($AxKit::Pipeline) = Apache::AxKit::PipeCtrl->new();
  -
  +	local $AxKit::Pipeline;
  +	
   
   	my $rc = $r->status();
   
       $AxKit::Cfg = Apache::AxKit::ConfigReader->new($r);
   
  +    my $controller = $AxKit::Cfg->PipelineControllerClass();
  +    
  +    load_module( $controller );
  +    
  +	$AxKit::Pipeline = $controller->new();
  +
  +
       if ($AxKit::Cfg->DebugTime) {
           require Time::HiRes;
           $AxKit::T0 = [Time::HiRes::gettimeofday()] if $AxKit::Cfg->DebugTime;
  @@ -272,6 +284,22 @@
   	bless $r, 'AxKit::Apache';
       my $provider = Apache::AxKit::Provider->new_content_provider($r);
   
  +    if (my $charset = $AxKit::Cfg->OutputCharset) {
  +        AxKit::Debug(5, "Different output charset: $charset");
  +        if (!$r->notes('axkit_passthru_type')) {
  +            $r->content_type("text/html; charset=$charset");
  +        }
  +    }
  +    
  +    # This is here so that lookup_uri() works on the real thing
  +    # that we're requesting, not on the thing plus the PATH_INFO
  +
  +    my $uri = $r->uri();
  +    my $path_info = $r->path_info();
  +    substr($uri, -length($path_info)) = '' if length($path_info); # trim off the end that
many chars (negative offset to substr)
  +    $r->uri($uri);
  +    $ENV{PATH_INFO} = $path_info;
  +
       my $retcode = eval {
       
       	return $provider->decline(reason => "passthru set")
  @@ -292,10 +320,8 @@
   
           reset_depends();
           
  -		my $pipeline = build_pipeline($r, $provider, 0);
  -		
  -		return $pipeline->send($r);
  -
  +		return $AxKit::Pipeline->send($r, $provider);	# returns ret_code;
  +	
       };
       my $E = $@;
       unless ($E) {
  @@ -384,41 +410,6 @@
       return DECLINED;
   }
   
  -sub build_pipeline{
  -    my ($r, $provider, $no_output) = @_;
  -    
  -    # get preferred stylesheet and media type
  -    my ($preferred, $media) = get_style_and_media();
  -    AxKit::Debug(2, "media: $media, preferred style: $preferred");
  -
  -    my $styles = get_styles($media, $preferred, $provider, $r);
  -    
  -    if (my $charset = $AxKit::Cfg->OutputCharset) {
  -        AxKit::Debug(5, "Different output charset: $charset");
  -        if (!$r->notes('axkit_passthru_type')) {
  -            $r->content_type("text/html; charset=$charset");
  -        }
  -    }
  -    
  -    # This is here so that lookup_uri() works on the real thing
  -    # that we're requesting, not on the thing plus the PATH_INFO
  -
  -    my $uri = $r->uri();
  -    my $path_info = $r->path_info();
  -    substr($uri, -length($path_info)) = '' if length($path_info); # trim off the end that
many chars (negative offset to substr)
  -    $r->uri($uri);
  -    $ENV{PATH_INFO} = $path_info;
  -    
  -    $AxKit::Pipeline->add_styles( @$styles );
  -    
  -	my ($transformer, $doit) = AxKit::get_output_transformer();
  -	my $last_in_chain = !($no_output || $doit || lc($r->dir_config('Filter')) eq 'on' );
  -			
  -	my $pipeline = $AxKit::Pipeline->create_pipeline( $r, $provider, $last_in_chain );
  -		
  -	return $pipeline;
  -}	
  -
   sub get_axkit_uri {
       my ($uri) = @_;
       
  @@ -463,17 +454,13 @@
   
       my $provider = Apache::AxKit::Provider->new_content_provider($r);
   
  -	local($AxKit::Pipeline) = Apache::AxKit::PipeCtrl->new();
  -    
  -    my $pipeline = build_pipeline($r, $provider, 1); # no output;
  -        
  +	local($AxKit::Pipeline) = $AxKit::Cfg->PipelineControllerClass()->new();
  +            
      	bless $r, 'AxKit::Apache';
      	
      	my $result_code;
      	
  -    my $str_ref = eval { 
  -    	$pipeline->get_strref( $r ); 
  -    };
  +    my $str_ref = eval { $AxKit::Pipeline->get_subrequest_ref( $r, $provider ) };
        
       if ($@) {
           my $E = $@;
  @@ -558,7 +545,7 @@
   }
   
   sub reset_stylesheets {
  -   $AxKit::Pipeline = Apache::AxKit::PipeCtrl->new();
  +   $AxKit::Pipeline = AxKit::Cfg->PipelineControllerClass()->new();
   }
   
   sub get_style_and_media {
  @@ -572,39 +559,6 @@
   #    }
   
       return ($style, $media);
  -}
  -
  -sub get_styles {
  -    my ($media, $style, $provider, $r) = @_;
  -
  -	# This cache is only generating a key for the style cache.
  -
  -    my $key = Apache::AxKit::Cache->new($r, $provider->key() . 
  -    	($r->path_info() || ''), $style, $media )->key();
  -
  -    AxKit::Debug(2, "getting styles and external entities from the XML");
  -    # get styles/ext_ents from cache or re-parse
  -
  -    my $styles;
  -
  -    if (!$r->dir_config('AxDisableGetStylesCache') 
  -	    && exists($AxKit::Stash{$key})
  -            && !$provider->has_changed($AxKit::Stash{$key}{mtime}))
  -    {
  -        AxKit::Debug(3, "styles cached");
  -        return $AxKit::Stash{$key}{'styles'};
  -    }
  -    else {
  -        AxKit::Debug(3, "styles not cached - calling \$provider->get_styles()");
  -        my $styles = $provider->get_styles($media, $style);
  -
  -        $AxKit::Stash{$key} = {
  -            styles => $styles,
  -            mtime => $provider->mtime(),
  -            };
  -
  -        return $styles;
  -    }
   }
   
   sub prep_exception {
  
  
  

Mime
View raw message