You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rommel Sharma <rs...@sapient.com> on 2012/06/25 15:57:02 UTC

[users@httpd] Getting the request URL details using PerlOutputFilterHandler

Hi All,

I am using PerlOutputFilterHandler. I need to customize/filter the output based on where (for which resource) the request came from.

How can I find the URL from where the request was made?

Thanks,
Rommel.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Getting the request URL details using PerlOutputFilterHandler

Posted by Rommel Sharma <rs...@sapient.com>.
Many thanks Torsten for the valuable inputs. It worked just fine using the approach you provided. This is great help! Thank you!

I am now checking why perl filtering is not working for pages being served from jboss (routed to it via the apache web server) when it is working just fine for pages served from Apache's htdocs (being filtered as expected) and access is fine for jboss pages that are not under the filter Location. Will be posting that to jboss/mod_perl list. My config is:

<Location ~ "/(staticweb|jbossweb)">
    SetHandler modperl
    PerlOutputFilterHandler MyOutputHandlers::CustomFilterResponse
    allow from all
</Location>

staticweb is under htdocs and jbossweb is an app-context deployed in jboss .

Rommel.


-----Original Message-----
From: Torsten Förtsch [mailto:torsten.foertsch@gmx.net] 
Sent: Monday, June 25, 2012 9:44 PM
To: users@httpd.apache.org
Cc: Rommel Sharma
Subject: Re: [users@httpd] Getting the request URL details using PerlOutputFilterHandler

On 06/25/2012 03:57 PM, Rommel Sharma wrote:
> I am using PerlOutputFilterHandler. I need to customize/filter the output based on where (for which resource) the request came from.
> 
> How can I find the URL from where the request was made?


sub filter {
  my ($f, $bb)=@_;
  my $r=$f->r;             # this gives you the current request object
                           # see Apache2::RequestRec

  $r->uri;                 # these fields you may be interested in
  $r->unparsed_uri;
  $r->the_request;
  $r->filename;
}

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html

Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting the request URL details using PerlOutputFilterHandler

Posted by Torsten Förtsch <to...@gmx.net>.
On 06/25/2012 03:57 PM, Rommel Sharma wrote:
> I am using PerlOutputFilterHandler. I need to customize/filter the output based on where (for which resource) the request came from.
> 
> How can I find the URL from where the request was made?


sub filter {
  my ($f, $bb)=@_;
  my $r=$f->r;             # this gives you the current request object
                           # see Apache2::RequestRec

  $r->uri;                 # these fields you may be interested in
  $r->unparsed_uri;
  $r->the_request;
  $r->filename;
}

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html

Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org