You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@apache.org on 2003/10/31 01:06:22 UTC

cvs commit: xml-axkit/t/htdocs/style/error 500.xsl

mach        2003/10/30 16:06:22

  Modified:    .        Tag: axkit-pipeline-2 MANIFEST
               lib      Tag: axkit-pipeline-2 AxKit.pm
               lib/Apache/AxKit Tag: axkit-pipeline-2 Pipeline.pm
               lib/Apache/AxKit/Pipeline Tag: axkit-pipeline-2 Tail.pm
               t/conf   Tag: axkit-pipeline-2 extra.last.conf.in
  Added:       lib/Apache/AxKit/Provider Tag: axkit-pipeline-2 Error.pm
               t/error  Tag: axkit-pipeline-2 server500.t
               t/htdocs/error Tag: axkit-pipeline-2 01.xsp
               t/htdocs/style/error Tag: axkit-pipeline-2 500.xsl
  Log:
  Making server errors handled via ErrorDocuments, which removes process_error
  and AxErrorStyles... also restoring the original Exception::Declined.
  
  Mike.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.20.2.7  +4 -0      xml-axkit/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /home/cvs/xml-axkit/MANIFEST,v
  retrieving revision 1.20.2.6
  retrieving revision 1.20.2.7
  diff -u -r1.20.2.6 -r1.20.2.7
  --- MANIFEST	29 Oct 2003 21:48:12 -0000	1.20.2.6
  +++ MANIFEST	31 Oct 2003 00:06:22 -0000	1.20.2.7
  @@ -158,6 +158,7 @@
   lib/Apache/AxKit/Provider/Filter.pm
   lib/Apache/AxKit/Provider/Scalar.pm
   lib/Apache/AxKit/Provider/DOM.pm
  +lib/Apache/AxKit/Provider/Error.pm
   lib/Apache/AxKit/PipeCtrl.pm
   lib/Apache/AxKit/Pipeline/Cache.pm
   lib/Apache/AxKit/Pipeline/DoStyles.pm
  @@ -238,4 +239,7 @@
   t/pipeline/04gzip.t
   t/htdocs/pipeline/gzip/01.xml
   t/htdocs/style/pipeline/gzip/01.xsl
  +t/error/server500.t
  +t/htdocs/error/01.xsp
  +t/htdocs/style/error/500.xsl
   typemap
  
  
  
  No                   revision
  No                   revision
  1.53.2.3  +10 -57    xml-axkit/lib/AxKit.pm
  
  Index: AxKit.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/AxKit.pm,v
  retrieving revision 1.53.2.2
  retrieving revision 1.53.2.3
  diff -u -r1.53.2.2 -r1.53.2.3
  --- AxKit.pm	27 Oct 2003 00:59:54 -0000	1.53.2.2
  +++ AxKit.pm	31 Oct 2003 00:06:22 -0000	1.53.2.3
  @@ -308,7 +308,7 @@
       }
       
       AxKit::Debug(5, "Caught an exception");
  -    
  +        
       # restore $r if it hasn't been restored already
       if (ref($r) eq 'AxKit::Apache') {
           bless $r, 'Apache';
  @@ -325,15 +325,17 @@
           my $code = $E->{return_code};
       	AxKit::Debug(5, "aborting with code $code");
           return $code;
  -    } elsif($E->isa('Apache::AxKit::Exception::Declined')) {
  -		return DECLINED;
  -	}
  +    } 
  +    
  +# 	elsif($E->isa('Apache::AxKit::Exception::Declined')) {
  +#		return DECLINED;
  +#	}
       
       $r->content_type($AxKit::OrigType)
       	if $r->content_type() eq 'changeme'; # restore content-type
      
   	
  -    if ($E->isa('Apache::AxKit::Exception::ProviderDeclined')) {
  +    if ($E->isa('Apache::AxKit::Exception::Declined')) {
           if ($AxKit::Cfg && $AxKit::Cfg->LogDeclines()) {
               $r->log->warn("[AxKit] [DECLINED] $E->{reason}")
                       if $E->{reason};
  @@ -366,10 +368,7 @@
               $r->log->error("[AxKit] [Backtrace] " . $E->stacktrace);
           }
   
  -        my $error_styles = $AxKit::Cfg->ErrorStyles;
  -        if (@$error_styles) {
  -            return process_error($r, $E, $error_styles);
  -        }
  +		$r->notes('axkit_error', $E->as_xml( $r->filename() ));
   
           return SERVER_ERROR;
   
  @@ -381,11 +380,7 @@
               $r->log->error("[AxKit] [Backtrace] " . $E->stacktrace);
           }
   
  -        # return error page if a stylesheet for errors has been provided
  -        my $error_styles = $AxKit::Cfg->ErrorStyles;
  -        if (@$error_styles) {
  -            return process_error($r, $E, $error_styles);
  -        }
  +		$r->notes('axkit_error', $E->as_xml( $r->filename() ));
   
           return SERVER_ERROR;
       }
  @@ -482,7 +477,7 @@
        
       if ($@) {
           my $E = $@;
  -        if ($E->isa('Apache::AxKit::Exception::ProviderDeclined')) {
  +        if ($E->isa('Apache::AxKit::Exception::Declined')) {
               if ($AxKit::Cfg && $AxKit::Cfg->LogDeclines()) {
                   $r->log->warn("[AxKit] [DECLINED] $E->{reason}")
                           if $E->{reason};
  @@ -525,48 +520,6 @@
       }
   }
   
  -sub process_error {
  -    my ($r, $E, $error_styles) = @_;
  -    
  -#    bless $r, 'AxKit::Apache';
  -#    tie *STDOUT, 'AxKit::Apache', $r;
  -
  -    $r->dir_config->set(AxNoCache => 1);
  -    
  -    $r->content_type("text/html; charset=UTF-8"); # set a default for errors
  -
  -    my $error = $E->as_xml($r->filename);
  -
  -	local($AxKit::Pipeline) = Apache::AxKit::PipeCtrl->new();
  -
  -    my $provider = Apache::AxKit::Provider::Scalar->new(
  -            $r, $error, $error_styles
  -    );
  -
  -    eval {
  -		my ($transformer, $doit) = AxKit::get_output_transformer();
  -		my $last_in_chain = !( $doit || lc($r->dir_config('Filter')) eq 'on' );
  -
  -
  -		$AxKit::Pipeline->add_styles( @$error_styles );
  -			
  -		my $pipeline = $AxKit::Pipeline->create_pipeline( $r, $provider, $last_in_chain );
  -	 
  -		$pipeline->send($r);
  -
  -		my $ret_val = $r->status();
  -	
  -		AxKit::Debug(5, "pipeline finished with apache status $ret_val");
  -    
  -    };
  -
  -    if ($@) {
  -        $r->log->error("[AxKit] [FATAL] Error occured while processing Error XML: $@");
  -        return SERVER_ERROR;
  -    }
  -    
  -    return OK;
  -}
   
   sub insert_next_stylesheet {
       my ($type, $href) = @_;
  
  
  
  No                   revision
  No                   revision
  1.1.2.6   +3 -3      xml-axkit/lib/Apache/AxKit/Attic/Pipeline.pm
  
  Index: Pipeline.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Attic/Pipeline.pm,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- Pipeline.pm	29 Oct 2003 21:42:53 -0000	1.1.2.5
  +++ Pipeline.pm	31 Oct 2003 00:06:22 -0000	1.1.2.6
  @@ -24,6 +24,7 @@
   	$self->upstream()->init( $r );
   
   	if ($self->stylesheet_exists()) {
  +	
   		my $styleprovider = Apache::AxKit::Provider->new_style_provider( $r, uri => $self->href());
   		
   		if(!$styleprovider->exists()) {
  @@ -159,9 +160,8 @@
       bless $r, 'AxKit::Apache';
       tie *STDOUT, 'AxKit::Apache', $r;   
       
  -	my $bytes = $self->get_bytes_ref( $r );	# last in chain
  -												# Pipeline my throw a DECLINED
  -												# as it could fast deliver from a cache
  +	my $bytes = $self->get_bytes_ref( $r );
  +	
       my $result_code = $r->status();
   
       if (ref($r) eq 'AxKit::Apache') {
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +2 -0      xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Tail.pm
  
  Index: Tail.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Tail.pm,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Tail.pm	27 Oct 2003 00:59:55 -0000	1.1.2.1
  +++ Tail.pm	31 Oct 2003 00:06:22 -0000	1.1.2.2
  @@ -31,6 +31,8 @@
   	}
   	return $str_ref;
   }
  +
  +sub stylesheet_exists{ 0; }
   	
   # How do we want to handle all sax queue?	
   	
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +62 -0     xml-axkit/lib/Apache/AxKit/Provider/Attic/Error.pm
  
  
  
  
  No                   revision
  No                   revision
  1.7.2.6   +16 -0     xml-axkit/t/conf/extra.last.conf.in
  
  Index: extra.last.conf.in
  ===================================================================
  RCS file: /home/cvs/xml-axkit/t/conf/extra.last.conf.in,v
  retrieving revision 1.7.2.5
  retrieving revision 1.7.2.6
  diff -u -r1.7.2.5 -r1.7.2.6
  --- extra.last.conf.in	29 Oct 2003 21:42:53 -0000	1.7.2.5
  +++ extra.last.conf.in	31 Oct 2003 00:06:22 -0000	1.7.2.6
  @@ -191,3 +191,19 @@
   	AxGzipOutput On
   </Location>	
   
  +<Location "/error/01.xsp">
  +	SetHandler axkit
  +	AxResetProcessors
  +	AxAddStyleMap application/xsp Apache::AxKit::Pipeline::XSP
  +	AxAddProcessor application/xsp NULL
  +	ErrorDocument 500 /error/500
  +</Location>
  +
  +<Location "/error/500">
  +	SetHandler axkit
  +	AxResetProcessors
  +	AxContentProvider Apache::AxKit::Provider::Error
  +	AxAddProcessor text/xsl /style/error/500.xsl
  +</Location>
  +		
  +
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +17 -0     xml-axkit/t/error/Attic/server500.t
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +9 -0      xml-axkit/t/htdocs/error/Attic/01.xsp
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +9 -0      xml-axkit/t/htdocs/style/error/Attic/500.xsl