[MP2]how to catch the response body of a subrequest?

[MP2]how to catch the response body of a subrequest?

am 01.07.2008 13:48:01 von titetluc

------=_Part_34083_24316832.1214912881445
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello all,

I am facing a problem: I would like to call sub-requests, but the content of
these sub-requests should not 'pollute' the main request.

Some times ago, Torsten Foertsch sent the same question on the mod_perl
mailing list (see http://marc.info/?l=apache-modperl&m=111720092815754&w=2)

The answer from Stas Bekman was to use ... the sub request API.

I reread the documentation but the solution is not very explicit.
Could someone give me an example to trap the response body of the subrequest
? (Maybe the solution is to use filters but how can I create this filter
????)

Thanks

------=_Part_34083_24316832.1214912881445
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello all,

I am facing a problem: I would like to call sub-requests, but
the content of these sub-requests should not 'pollute' the main request.

Some times ago, Torsten Foertsch sent the same question on the mod_perl mailing list (see )


The answer from Stas Bekman was to use ... the sub request API.

I reread the documentation but the solution is not very explicit.
Could someone give me an example to trap the response body of the subrequest ? (Maybe  the solution is to use filters but how can I create this filter ????)


Thanks



------=_Part_34083_24316832.1214912881445--

Re: [MP2]how to catch the response body of a subrequest?

am 01.07.2008 14:13:45 von torsten.foertsch

On Tue 01 Jul 2008, titetluc titetluc wrote:
> I am facing a problem: I would like to call sub-requests, but the content
> of these sub-requests should not 'pollute' the main request.

my $content='';
my $subr=$r->lookup_uri( $tmpl );
$subr->add_output_filter( sub {
my ($f, $bb) = @_;
while (my $e = $bb->first) {
$e->read(my $buf);
$content.=$buf;
$e->delete;
}
return Apache2::Const::OK;
} );
$subr->run;

Torsten

--
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

Re: [MP2]how to catch the response body of a subrequest?

am 01.07.2008 15:00:53 von titetluc

------=_Part_34349_5723286.1214917253150
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Less than half an hour to have an answer !!!!
And the code is correctly running (my work now is to understand this cryptic
code ;-))

Thanks a lot


2008/7/1 Torsten Foertsch :

> On Tue 01 Jul 2008, titetluc titetluc wrote:
> > I am facing a problem: I would like to call sub-requests, but the content
> > of these sub-requests should not 'pollute' the main request.
>
> my $content='';
> my $subr=$r->lookup_uri( $tmpl );
> $subr->add_output_filter( sub {
> my ($f, $bb) = @_;
> while (my $e = $bb->first) {
> $e->read(my $buf);
> $content.=$buf;
> $e->delete;
> }
> return Apache2::Const::OK;
> } );
> $subr->run;
>
> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: torsten.foertsch@gmx.net
>

------=_Part_34349_5723286.1214917253150
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Less than half an hour to have an answer !!!!
And the code is correctly running (my work now is to understand this cryptic code ;-))

Thanks a lot


2008/7/1 Torsten Foertsch <>:

On Tue 01 Jul 2008, titetluc titetluc wrote:

> I am facing a problem: I would like to call sub-requests, but the content

> of these sub-requests should not 'pollute' the main request.



 my $content='';

 my $subr=$r->lookup_uri( $tmpl );

 $subr->add_output_filter( sub {

                             my ($f, $bb) = @_;

                             while (my $e = $bb->first) {

                               $e->read(my $buf);

                               $content.=$buf;

                               $e->delete;

                             }

                             return Apache2::Const::OK;

                           } );

 $subr->run;



Torsten



--

Need professional mod_perl support?

Just hire me:




------=_Part_34349_5723286.1214917253150--